• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

how to display the resultset into the JTabel ?

 
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
What are your superhero powers? Go ahead and try them on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic