• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use Table model to include database values

 
partha phukan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir, please give me some suggestion regarding how to use table model to include database values. i have used metadata to include database values in a JTable, it is working fine and it display results without any error, but i have a problem in refreshing the JTable to include new datas.

Is it possible to refresh the JTable with new values without using table model? whether i have to change the using of metadata to retrieve data from database? is there any way. please give me some hints that how should i proceed..

Thanks in advance.
 
Rob Camick
Ranch Hand
Posts: 2613
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to refresh the JTable with new values without using table model?


No. The table can only display data found in the table model.

You can use table.setValueAt(....) to change the data on a cell by cell basis.

Or you can use table.setModel(...) to change all the data at oonce.
 
partha phukan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you sir for your reply. But sir, is my way of of retrieving data from database need to be changed i.e i mean to say that whether the use of metadata need to be changed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic