这是我的问题
result = s.executeUpdate("INSERT INTO order " + "VALUES ('" + id.getText() + "','" + name.getText() + "', '" + code.getText() + "','" + price.getText() + "')");
我遇到了这个异常:
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 'order VALUES (('1'),('1'),( '1'),('1')' at line 1
最佳答案
Order 是一个保留字——我不会将它用作表名,但如果您坚持使用它,只需在它周围放回勾号。 插入 `order` ...
关于mysql - 你的sql语法有误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32361189/