【发布时间】:2020-04-08 05:21:36
【问题描述】:
代码:
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/smtp_program","root","xxxx");
PreparedStatement stmt =
con.prepareStatement("DELETE FROM smtp_program.users WHERE username=?");
stmt.setString(1,"'"+user+"'");
stmt.executeUpdate();
} catch (Exception e) {
System.out.println(e);
}
变量用户作为字符串传入。
返回错误:[42S22][1054] 'where 子句'中的未知列'test1'
【问题讨论】:
标签: java mysql intellij-idea