• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

storing values from JTable  RSS feed

 
Greenhorn
Posts: 21
  • 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!!!
 
author & internet detective
Marshal
Posts: 38508
653
Eclipse IDE Java VI Editor
  • 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
  • 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! ;-}
 
Ranch Hand
Posts: 572
  • 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
  • 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! (",)
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!