Updating database from jtable

Posted by / 25-Oct-2019 03:03

To do User double clicks on any field in the j Table, edits the contents and repeats the steps for multiple cells in various rows and columns. When the user clicks that button in the j Panel, all the entries in the j Table which are edited must be updated in the employee table in the database. My work so far I am currently with the logic that since it is multiple cell editing, go with a for loop through each and every cell and update the result set and then update the table.

My code so far is given below * event, but it shows an error "Variable not found" in Net Beans.

Try using the Default Table Model to see if you have a problem.I am able to listen to the event and get changed values.But I dont want that the user to move columns through dragging.Now with user being able to see their search results in the JTable, they are able to edit it.Then once they click update, the new edited JTable should be updated into my database. I was thinking about just taking the whole table model and sending that off to my database to replace what is there.

updating database from jtable-64updating database from jtable-53updating database from jtable-76

I have found the same problem posted by some other person and you have replied it. Thanking you, Agatha.i tested the code i posted and it worked perfectly but people on sun forums says that it's such a bad behaviour to mix the ui and the database,and there's no object oriented here??? You want to get the logic for updating the database (in MVC, the "C") a long way away from the display (the "V") because the two perform different things, and it allows easy maintenance if the two are well separated. Step 1: It's going to be way easier for the whole thing if you make your table extend a Table Model from now (if you haven't already). Step 2: In the table model you need to enable the cells to be editable.

One thought on “updating database from jtable”