Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JBDC and Combo boxes or lists

 
matthew weeks
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
matthew weeks
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont suppose you've got a full example/code that you could give us to show how it works.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
matthew weeks
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help, ive final got it working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic