 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Sergio E. Guest
|
Posted: Mon Oct 16, 2006 7:57 pm Post subject: jdbcombobox |
|
|
Hi,
I'm developing an swing screen using the dbswing controls with jbuilder2006
with the following information:
1 Table Customers:
IdCustomer
First Name
Last Name
....
Address
IdState
IdCountry
IdCustomerType
and 1 Table for each catalog to be related:
Table States
IdState
ShortDescS
LongDescS
Table Country
IdCountry
CountryName
CurrencyName
Table CustomerType
IdCustomerType
ShortDescCT
LongDescCT
Discount
MinBuy2Discount
Basicly I need a swing screen that can select from a combo the shordesc from
a catalog and it returns the Id so i can use it and save in the table
customers.
My screen has the following items: an database object wiht the connection
string to the acces odbc database, a dbdisposemonitor object, 1 querydataset
object for each table I need with the apropiate select sentences (select *
from customers; select idstete, shortdescs from states; select idcountry,
countryname from country; select idcustomertype, shortdescct from
customertype), jdbtextboxes for each field in the table customers and 1
jdbcombobox for each catalog, and finally 1 jdbnavtoolbar object for the
register manipulation and 1 jdbstatuslabel object.
My problem is that i can't obtain the value Id from de jdbcombobox for copy
it to the corresponding jdbtext because it alway return to me the text from
the field desc but not the id.
I search in the web and first of all in the borland site and the only
document that say something about my problem it's too old and doesn't apply
to my version of the control
Somebody have done some similar?
I'm very novice in this languaje,
thanks in advance
Serigo E. |
|
| Back to top |
|
 |
Kevin Dean [TeamB] Guest
|
Posted: Tue Oct 17, 2006 6:25 am Post subject: Re: jdbcombobox |
|
|
Sergio E. wrote:
| Quote: | My problem is that i can't obtain the value Id from de jdbcombobox for
copy it to the corresponding jdbtext because it alway return to me the
text from the field desc but not the id.
|
As a general rule, you shouldn't access the controls to get the data.
What you should do instead is get the data from the data set directly:
myDataSet.getString("columnName")
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html |
|
| Back to top |
|
 |
Sergio E. Guest
|
Posted: Tue Oct 17, 2006 7:18 am Post subject: Re: jdbcombobox |
|
|
Kevin,
Thank you for answer me.
With your information I've a question more
I'm using the jdbnavtoolbar object because it seems very easy to deal with
de database, then, How can i do this "simple" task I need in a simple way? I
doesn't see a easy way to do the "select a text in a combo and get the id to
save in the database trick" with this control. I understand then that I need
to write all of the logic to communicate with the database (i.e., save
record, read next record, etc...)
Then I don't have clear why this control exists...
Thanks in advance for clarifiying me such things.
Atte.
Sergio E.
"Kevin Dean [TeamB]" <NkOdSePaAnM (AT) datadevelopment (DOT) com> escribió en el
mensaje news:xn0esjsjhut28b000-kdean (AT) www (DOT) teamb.com...
| Quote: | Sergio E. wrote:
My problem is that i can't obtain the value Id from de jdbcombobox for
copy it to the corresponding jdbtext because it alway return to me the
text from the field desc but not the id.
As a general rule, you shouldn't access the controls to get the data.
What you should do instead is get the data from the data set directly:
myDataSet.getString("columnName")
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html |
|
|
| Back to top |
|
 |
Kevin Dean [TeamB] Guest
|
Posted: Tue Oct 17, 2006 4:46 pm Post subject: Re: jdbcombobox |
|
|
Sergio E. wrote:
| Quote: | I'm using the jdbnavtoolbar object because it seems very easy to deal with
de database, then, How can i do this "simple" task I need in a simple way?
I doesn't see a easy way to do the "select a text in a combo and get the
id to save in the database trick" with this control. I understand then
that I need to write all of the logic to communicate with the database
(i.e., save record, read next record, etc...)
Then I don't have clear why this control exists...
|
The dbSwing components are for presenting, editing, and navigating through
data. For most applications, they are more than sufficient for your needs.
If you need to do anything special, such as validation, default values,
etc., you need to hook into the data set events directly. There is a
large number of events that allow you to intercept just about everything
imaginable at the data set level.
As for writing the data back to the database, that should be handled for
you by the data set component.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html |
|
| Back to top |
|
 |
Sergio E. Guest
|
Posted: Thu Oct 19, 2006 7:02 pm Post subject: Re: jdbcombobox |
|
|
thank you for clarify me this question.
Greeting
Sergio E.
"Kevin Dean [TeamB]" <NkOdSePaAnM (AT) datadevelopment (DOT) com> escribió en el
mensaje news:xn0esklhkr1hc000-kdean (AT) www (DOT) teamb.com...
| Quote: | Sergio E. wrote:
I'm using the jdbnavtoolbar object because it seems very easy to deal with
de database, then, How can i do this "simple" task I need in a simple way?
I doesn't see a easy way to do the "select a text in a combo and get the
id to save in the database trick" with this control. I understand then
that I need to write all of the logic to communicate with the database
(i.e., save record, read next record, etc...)
Then I don't have clear why this control exists...
The dbSwing components are for presenting, editing, and navigating through
data. For most applications, they are more than sufficient for your
needs.
If you need to do anything special, such as validation, default values,
etc., you need to hook into the data set events directly. There is a
large number of events that allow you to intercept just about everything
imaginable at the data set level.
As for writing the data back to the database, that should be handled for
you by the data set component.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|