Results 1 to 2 of 2
Thread: populating jtable from database
- 01-16-2013, 11:41 PM #1
Member
- Join Date
- Jan 2013
- Posts
- 1
- Rep Power
- 0
populating jtable from database
I am trying to fill a jTable from a resultset, but when I try to add it it asks for a TableModel and not a resultset.
Java Code:DBConnect dbSample = new DBConnect ("NAMES"); jTable1.setModel(dbSample.getDetails());Do I need to convert the resultset into a TableModel? If so how does one do this?Java Code:public ResultSet getDetails () throws SQLException { Statement stmt = conn.createStatement (); ResultSet rs = stmt.executeQuery ("SELECT * FROM DETAILS"); stmt.close (); return rs; }
- 01-16-2013, 11:56 PM #2
Senior Member
- Join Date
- Jan 2011
- Location
- Belgrade, Serbia
- Posts
- 227
- Rep Power
- 3
Re: populating jtable from database
How to Use Tables (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
Read this and see if it is helpful.
Similar Threads
-
populating jtable with resultSet - help needed
By smallmos1 in forum JDBCReplies: 2Last Post: 05-07-2011, 06:32 PM -
Jtable cells not populating correctly
By wlc in forum AWT / SwingReplies: 2Last Post: 04-04-2011, 05:57 AM -
Populating Jtable from database - better way?
By madhura2212 in forum AWT / SwingReplies: 5Last Post: 10-05-2010, 02:04 PM -
Populating JTable with 2 arrays (Netbeans)
By althair in forum AWT / SwingReplies: 3Last Post: 12-30-2009, 02:05 PM -
Populating a JTable
By toymachiner62 in forum New To JavaReplies: 2Last Post: 10-13-2009, 05:56 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks