0
我已经通过使用TableModelListener直接输入到Jtable单元格来为数据库设置值。但是我无法在更新后重新加载Jtable中的数据。当我在gui中更新一行时,如何从数据库重新加载Jtable内容?
public void setValueAt(Object value, int row, int column) {
String updateq = "update M_department set " + getColumnName(column) + "='"
+ value.toString() + "' where code='" + getValueAt(row, 0) + "'";
System.out.println(updateq);
try {
stmt.executeUpdate(updateq);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("Error" + e);
}
}