Hi guys,
Q: I have a JTable 5x10 I need to insert the content into a database (and later on retrieve it). Every record has a JTable and every record is unique (there are many records) the JTable will have its own table in the database (segmentsTable) and a KEY.
So: how do I place all the content into the table???
my solution, and please feel free to criticize this idea, is to get all information of each raw and insert it to the db.
like this:
public void save()
{
int row = table.getSelectedRow();
String col0 = table.getValueAt(row, 0).toString(); // Value of 0 is in this Variable
String col1 = table.getValueAt(row, 1).toString(); // Value of 1 is in this Variable
// and so on
// Do insert KEY + raw content
}
so basically I'll have to have a table with 10 attributes and each attribute will contain a raw.
What do you think? I am very new to db so I'm not sure this is the most efficient way to do this. if you know a better way to insert/update/select info from a jtable PLEAES let me know.
Thanks
Ppr
Q: I have a JTable 5x10 I need to insert the content into a database (and later on retrieve it). Every record has a JTable and every record is unique (there are many records) the JTable will have its own table in the database (segmentsTable) and a KEY.
So: how do I place all the content into the table???
my solution, and please feel free to criticize this idea, is to get all information of each raw and insert it to the db.
like this:
public void save()
{
int row = table.getSelectedRow();
String col0 = table.getValueAt(row, 0).toString(); // Value of 0 is in this Variable
String col1 = table.getValueAt(row, 1).toString(); // Value of 1 is in this Variable
// and so on
// Do insert KEY + raw content
}
so basically I'll have to have a table with 10 attributes and each attribute will contain a raw.
What do you think? I am very new to db so I'm not sure this is the most efficient way to do this. if you know a better way to insert/update/select info from a jtable PLEAES let me know.
Thanks
Ppr