• 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

cells in Jtable

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm... I think they could help you out more in the JDBC forum...

-Nate
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jamie,
please let me know if you find the solution. Im struggling with the same problem
 
jamie ong
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic