aspose file tools*
The moose likes JDBC and the fly likes JBDC and Combo boxes or lists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JBDC and Combo boxes or lists" Watch "JBDC and Combo boxes or lists" New topic
Author

JBDC and Combo boxes or lists

matthew weeks
Greenhorn

Joined: Feb 23, 2004
Posts: 15
Im trying to use either combo boxes or lists menus (in Swing) to allow me to select a specific column values from a table using JDBC and Access in order for me to add a record to the database.
I would greatly appreciate any help on this matter, as im going insane because of this.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

The most simplest way is to fill a Vector with your list from the database and pass that vector into the Constructor of your JComboBox. What exactly are you having a problem with? The SWING part of this or the JDBC part of this?
[ February 23, 2004: Message edited by: Gregg Bolinger ]

GenRocket - Experts at Building Test Data
matthew weeks
Greenhorn

Joined: Feb 23, 2004
Posts: 15
I dont suppose you've got a full example/code that you could give us to show how it works.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Heres some psuedo code

That is in no way complete. But that is the gist of it. Again, what part is confusing you? JDBC or SWING? That way at least we can focus more on the exact issue you are having rather than "how do I do it".
matthew weeks
Greenhorn

Joined: Feb 23, 2004
Posts: 15
Its the JDBC thats confusing me, im not the worlds expert on it, as you can tell. In the resultSet.getString, do you state the column names or what?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Matthew,
You can pass the column name or the column number. If you use the column number, it is determined by the order of the columns in the select clause.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
matthew weeks
Greenhorn

Joined: Feb 23, 2004
Posts: 15
Thanks for your help, ive final got it working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBDC and Combo boxes or lists