Article View: borland.public.jbuilder.java.swing
Article #7616combobox problems with jb4/interbase
From: Khusro M. Jaleel
Date: Mon, 08 Jan 2001 15:10
Date: Mon, 08 Jan 2001 15:10
63 lines
3757 bytes
3757 bytes
Hi there,
My question is complex, so I'm going to explain it step by step.
Basically, if I connect a combo box to a picklist in a dataset, and
setup a master/detail relationship in order to update my foreign keys
properly when the combo box changes, the changes are not saved back to
the database.
I've got an interbase database with a 'Client' table, which contains
information about clients, such as name, city, etc. Now I've got another
table called 'City' which will be used to hold a list of cities. Now the
'CityID' primary key of the City table is linked to the 'city' field in
the Client table. I've filled in both tables with sample data and can
query them fine with 'isql'.
Now I've made a simple frame in Jbuilder, and added two textfields and
one combo box to it.
I've created a queryDataSet1 which queries the whole Client table with
'select * from client'.
queryDataSet2 is 'select * from city' and
queryDataSet3 is 'select name from city'.
I open queryDataSet2, select the 'name' column and setup a picklist to
queryDataSet3, on the 'name' column. I don't select 'Enforce integrity'
or 'lookup column to display'.
Then I setup a master/detail relationship between 'cityID' in
queryDataSet3 and 'city' in queryDataSet1 (Client table). This is so
that jbuilder is aware of a relationship between them.
(Should I connect queryDataSet2 instead of queryDataSet3?)
Now I connect the textboxes to some columns in queryDataSet1, just to
display some client information, such as firstname. Then I connect the
combo box to queryDataSet3 so that it displays the list of cities. This
works while editing, but doesn't display anything while the program is
running! I've found that I need to add another picklist to
queryDataSet3's 'name' field as well for it to work properly.
I've added a button that calls 'database1.saveChanges (new DataSet[]
{queryDataSet1})' when clicked. I've also added 'Next' and 'Prev'
buttons that do work properly and allow me to go through each of the
records in the database one at a time. The combo box does change to
reflect the correct city for each client.
In any case, once the program is running and displaying information
correctly, I try to open the combo box and change the city name. After I
click on the 'Save' button, the 'city' foreign key in the Client table
is not updated to reflect the change.
If I add queryDataSet2, queryDataSet3 to my database1.saveChanges()
call, the actual name of the city in the 'City' table is overwritten and
I get two cities with the same name.
Sorry for the long post, but I believe I'm doing something that anyone
would want to be able to do, and I would really appreciate any help. I
just want the combo box to reflect the name of the city for each
particular client, and I also want to be able to save this information
across tables.
Thanks to anyone who may be able to help
Khusro
Technical Details
Message-ID:
<3A59D86C.8E85B805@iname.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!newsfeed.mesh.ad.jp!newsfeeds.belnet.be!naxos.belnet.be!news.belnet.be!bornews.borland.com!dnews!212.159.128.82Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,29d79ae7e017e73e,start X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-08 07:12:30 PST Message-ID: <3A59D86C.8E85B805@iname.com> Date: Mon, 08 Jan 2001 15:10:36 +0000 From: "Khusro M. Jaleel" <kjalil@iname.com> X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: combobox problems with jb4/interbase Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 212.159.128.82 X-Trace: 8 Jan 2001 07:09:16 -0800, 212.159.128.82 Lines: 64 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!newsfeed.mesh.ad.jp!newsfeeds.belnet.be!naxos.belnet.be!news.belnet.be!bornews.borland.com!dnews!212.159.128.82