• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

storing values from JTable

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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! (",)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic