mysql - 你的sql语法有误

标签 mysql jdbc

这是我的问题

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/

相关文章:

php - 创建搜索功能,为什么是 "Warning: Division by zero in/path/test.php on line 29 Query was empty"

java - 如何使用 UCanAccess 从 Java 将两个字符串插入到我的 Access 数据库中?

spring-boot - 使用 Kotlin 观察参数类型不匹配的 Spring Amqp Remoting

c++ - 在 64 位机器上从源代码构建 32 位 mysql c++ 连接器

php - 如何使用 PHP 和 MySQL 中的表单更新行位置?

php - 如果没有数据更改,Codeigniter update_batch 返回 false

java - 使用 JDBC 连接到 Athena 时找不到合适的驱动程序

MySQL 选择与某条记录无关的记录

java - 使用 jdbc 连接到数据库的安全问题

java - 无法连接到受 Kerberos 保护的 Phoenix 数据源