我想用Java Swing更新mysql記錄。似乎MySql Update語句存在一些問題。我已經粘貼代碼下:Java的Mysql更新語句
conDBase = getConnection();
stmt = conDBase.createStatement();
String sql = "update user set role = " + jComboBox1.getSelectedItem()+ "where userID =" + jComboBox2.getSelectedItem();
stmt.executeUpdate(sql);
conDBase.close();
JOptionPane.showMessageDialog(null, "User Role Updated");
this.dispose();
new Admin().setVisible(true);
什麼是你所面臨的問題? – Vaandu
您無法使用Java Swing更新MySQL行。 – EJP