This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

storing values from JTable

 
Jay Albano
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey there guys! i've got a problem here... i don't know how to store/save the values from the changes i've made in the table after retrieving information from the database to that table. need some help guys/gals!!!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jay,
Are you asking how to get the changes from the JTable or how to update the database to the new values once you have them or both?
 
Jay Albano
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yep... a little scenario goes like this...
there are already values stored in my database. these values are then retrieved and viewed using the JTable. after being viewed in the table, changes are allowed... the problem goes here, how can i make any updates in part or whole (as it depends on the situation) of the JTable entries to my database and still refer to those same locations?
if anything's still unclear, feel free to remind me,... thanks! ;-}
 
Ali Gohar
Ranch Hand
Posts: 572
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you asking about how to update the changed values in Database? If you display all the records from the DB table and allow the user to edit anyone including the primary key of the table then it will be difficult to update the record in the table. If there is a situation that you should allow all the values to updated by user then define a serial no of any number in table which will not be changed and every record will be updated against that serial no column. Your table would be something like following

SerialNO Col1 Col2 Col3
1 val val val
2 val val val

Now every record is against a spcific unique serial no so you can use that no while updating the records. I don't know JTable but you can store this serial no against each record in any hidden field or something else.

If i misunderstood the problem then expalin.
 
Jay Albano
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry if there's any misconception...anywayz, lets put it this way.

i have a database with some values on it... these values are then displayed in an application using JTable. changes are applicable in this JTable since it is 'setEnabled(true)'. if i were to make changes on this JTable, the problem goes here...

> how to make one field of it uneditable for the sake of the primary key,
> how to retrieve these values from the JTable,
> and after being retrieved (as assumed), how do i store it back to the database (updating the database)

im like gettin' confused in using JTable but it seems the better way in dislaying data from the database in terms of multiple entries.
thanks... for the clarrification. GBU! (",)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic