所以我想要做的是SQL - 爪哇 - UPDATE语句查询
JButton GrantButton = new JButton("Grant Seller Access");
GrantButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
String update_query = "UPDATE user SET usertype = 'seller' WHERE email = " & GrantField.getText()";"
//Here is where the error is stated on eclipse
PreparedStatement pSt = connect.prepareStatement(update_query);
pSt.setString(1, GrantField.getText());
pSt.execute();
JOptionPane.showMessageDialog(null, "The Request has been approved");
} catch (Exception e) {
e.printStackTrace();
}
}
});
“中的‘用户’表
WHERE
电子邮件更新‘用户类型’列从文本获得(/用户)值”
可以做到这一点吗?
任何帮助将不胜感激。
什么错误得到?哪些dbms使用? SQL服务器? – Sachu
'“&GrantField.getText()”;“'是无效的Java代码。**和**你需要告诉我们什么**完全**错误信息。你需要告诉我们你正在使用哪个DBMS –