This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes cells in Jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "cells in Jtable" Watch "cells in Jtable" New topic
Author

cells in Jtable

jamie ong
Greenhorn

Joined: Nov 05, 2001
Posts: 24
hi there,
i have a Jtable which allow cell editable, how can i update the information in the db once an user edit the content in the cell? i use a MS access as backend.
many thanks!
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Hmmm... I think they could help you out more in the JDBC forum...

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Martin Schneider
Ranch Hand

Joined: May 16, 2002
Posts: 42
Hi Jamie,
please let me know if you find the solution. Im struggling with the same problem
jamie ong
Greenhorn

Joined: Nov 05, 2001
Posts: 24
hi martin,
managed to find a solution, though i not sure whether it is what you want.
anyway what i did is to add a TableModelListener to the TableModel(i use DefaultTableModel) and implement the TableChanged method to update to the DB using sql statement when the listener detect a change.
Of cos, you need to get the values from the JTable, to get edited values use JTable.getModel().getValueAt(int row, int col), instead of JTable.getValueAt(int row, int col).
So far, i still trying to see if it will generate any further bugs, using this method. Btw, you have to be careful on using the listener if your program involves refreshing after data are updated. if not it will generate exception such as "Sorter not informed of a change in model."
if my explanation is unclear, do let me know.
hope the info is useful to you.
[ June 07, 2002: Message edited by: jamie ong ]
[ June 07, 2002: Message edited by: jamie ong ]
Martin Schneider
Ranch Hand

Joined: May 16, 2002
Posts: 42
Thanks Jamie,
that might also be the solution to my problem. Anyway, if you find something that is useful (for this issue) to know please let me know
-Martin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cells in Jtable
 
Similar Threads
JTable
JTable
jtable
JTable
JTable