Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable not showing database query result properly  RSS feed

 
Deborah Larsson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone!

I wrote the following code and tested it in a separate class and with println I see that it gives the expected query results.
However when I give it to the JTable constructor as a Vector parameter to fill it with data, it only shows the last stored rows, multiplied by the amount of times I called the frame that shows that table.
So when the last rows are [1,2,3] [4,5,6] [7,8,9], (shows correctly in println!) on the first click that creates this table, the table content is [1,2,3] on second click [4,5,6] [4,5,6] etc.
I get no errors, it just shows the wrong data.
Thanks ahead for your help.


 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deborah Larsson wrote:querytemp.clear();


Instead of this, create a new vector, otherwise all the rows in the table will be the same!
 
Deborah Larsson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lorand Komaromi wrote:
Deborah Larsson wrote:querytemp.clear();


Instead of this, create a new vector, otherwise all the rows in the table will be the same!


Thank you for the tip, it worked!
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Np! :)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!