为什么我的 jTable 中的值会覆盖从 jcombobox 中选择的第一个值?有人可以帮我解决这个代码:
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Connection con;
Statement stmt;
try {
// TODO add your handling code here
Class.forName("sun.jdbc.odbc.JdbcOdbc");
} catch (ClassNotFoundException ex) {
JOptionPane.showMessageDialog(null, ex);
}
try {
con= DriverManager.getConnection("Jdbc:Odbc:food");
stmt= con.createStatement();
int row = 0;
String st= JcbSub.getSelectedItem().toString();
jTable3.setValueAt(st, row, 0);
row ++;
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, ex);
}
}