public static void updateData(Connection con, String make, String reg) {
String selectString = "UPDATE Cars SET Make = ? WHERE Reg = ?";
try
{
PreparedStatement pStmt = con.prepareStatement(selectString);
pStmt.setString(1, make);
pStmt.setString(2, reg);
pStmt.executeUpdate(selectString);
pStmt.close();
}...
这段代码出现以下错误:
SQL Exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? WHERE Reg = ?' at line 1
如果有人能帮助我,我将不胜感激。我四处搜索,但我的问题与我找到的解决方案完全不同。
最佳答案
使用用于PreparedStatements
的重载executeUpdate
pStmt.executeUpdate();
关于java - 在 '? WHERE Reg = ?' 附近使用的正确语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40486301/