This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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!!!
Trust in the Lord with all thine heart and lean not unto thine own understanding, <br />in all thy ways acknowledge Him and He shall direct thy path.<br /> <br />blue jay�
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! ;-}
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.
Joined: May 07, 2004
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! (",)