0
我試圖更新MySQL中的表,這是代碼:MySql的更新錯誤的Java
PreparedStatement ps = con.prepareStatement("UPDATE PbnNumberPlayer SET jointime=?, unique=? WHERE server=?");
ps.setInt(1, jointime);
ps.setInt(2, unique);
ps.setString(3, name);
ps.executeUpdate();
ps.close();
,我得到的錯誤是:在查詢原因
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unique=0 WHERE server='pbns4'' at line 1
我們需要查看整個代碼塊以確定問題所在。例如,目前無法理解「jointime」,「unique」或「name」的值。請張貼整段代碼。 – dat3450
也許試試'ps.executeQuery();'而不是'ps.executeUpdate();'。 – dat3450
ps.executeUpdate();是你想要使用的。檢查**名稱**變量的內容。看起來你在那裏有問題。事實上,檢查所有變量的內容。確保它們包含你所期望的。 – DevilsHnd