【发布时间】:2015-09-02 19:05:31
【问题描述】:
这是我的查询
result = s.executeUpdate("INSERT INTO order " + "VALUES ('" + id.getText() + "','" + name.getText() + "', '" + code.getText() + "','" + price.getText() + "')");
我遇到了这个异常:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 你有一个 SQL 语法错误;检查与您对应的手册 MySQL 服务器版本,用于在 'order VALUES 附近使用正确的语法 (('1'),('1'),('1'),('1')' 在第 1 行
【问题讨论】:
-
警告:你有一个severe SQL injection bug here,所以我先解决这个问题。然后去掉多余的括号。