Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How Fill a TableView with a ResultSet?

872262Jun 29 2011 — edited Jul 2 2011
I have a query, whose number of columns changes depending on the outcome of the ResultSet. My query finds a word in a different table and a different field each time.

h3. rs = stmt.executeQuery("SELECT * FROM " + table + " WHERE " + field + " LIKE " + "'%" + search + "%'" );

So I make a tableView to put all data. But every query return a different number of columns and I can't build the tableView.

Someone knows a way to create the columns with the number of columns that gets with the function
h3. rs.getMetaData.getColumnCount();

h2. how fill a tableView with a ResultSet??
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 30 2011
Added on Jun 29 2011
6 comments
1,022 views