File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display the resultset into the JTabel ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i know that to display data in Jtable is like

but my problem arises when i want to pull the data from the database and used it in the Jtable's constructor i mean
i know that the result of the sql quary "select * from emp" gives me all the data in that table which is holded by Result rs ....
now my question is how i can use this rs which contain my data of table emp so that i will be able to see my data in the JTabel ?
i have done my homework by asking "google" but unfortunately he is not able to help me , so if you experience guyz can show me this thing with a help of a simple example that will be great !
 
Minh Nam
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, a simple way is to iterate over the result to build the vector of data which is passed into table's constructor:



However I suggest you to use a table model to store table data, something like this:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic