• Post Reply Bookmark Topic Watch Topic
  • New Topic

JList elements from JDBC query

 
AMIT ARADHYE
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my code I have one JList.Whose elements will be the set of String obtained from JDBC query. Please tell me in deatil--how to do that.I am stuck-up badly.
It goes as....
ResultSet rs=Statement.executeQuery("select * from table(tablename)");
//it gives five number of strings.
How to proceed further from here.......
 
Javaoops
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ResultSet rs=Statement.executeQuery("select * from table(tablename)");
Vector data = new Vector()
while(rs.next()){
data.add(rs.getString("requiredfield index / Name "));
// data.add(rs.getString(1));
}
JList.setListData(data);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!