2

更新クエリを使用してデータベースを更新しようとしていますが、次のようなエラーが表示されます

Error 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 'add=null,col=null,wok=null,pcol=null,pwok=null,bio=null where un ='null'' at line 1.

SQL 構文のエラーの原因を突き止めようと何時間も試みましたが、解決できませんでした。

更新クエリは次のとおりです。

query = "Update users SET em=?, mn=?,add=?,col=?,wok=?,pcol=?,pwok=?,bio=? where un ='"+un+"'";

更新構文のエラーを理解するのに助けが必要です、ありがとう。

4

3 に答える 3

1

ADD は mysql の予約語であり、バックティックを使用します

\`add\`=?

http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-5.html

于 2013-09-06T09:02:55.190 に答える