File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes inserting Jtable cell values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "inserting Jtable cell values" Watch "inserting Jtable cell values" New topic

inserting Jtable cell values


Joined: Jan 14, 2002
Posts: 2
Hi all..
here i want to insert Jtable cell values into database...plz can any one help me out with code..
thanks in advance
Jagan Reddy

Joined: Nov 11, 2001
Posts: 7
I think this code might help u out.
for(int i=0;i<table.getRowCount();i++) { //table is the name of ur JTable

String sbValues = "insert into table values(";//table is the name of the table in the database where data is to be inserted
String sbData = "";

for(int j=0;j<table.getColumnCount();j++) {
String s2 =(String)table.getValueAt(i,j);
s2 = "";
statement.executeUpdate(sbData); //statement is ur statement object.
I agree. Here's the link:
subject: inserting Jtable cell values
It's not a secret anymore!