String sql=" delete from rizhi where data="+data;为什么总是报错,data为varchar型.错误提示: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 ' at line 1

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 00:50:05
String sql=

String sql=" delete from rizhi where data="+data;为什么总是报错,data为varchar型.错误提示: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 ' at line 1
String sql=" delete from rizhi where data="+data;为什么总是报错,data为varchar型.
错误提示: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 ' at line 1

String sql=" delete from rizhi where data="+data;为什么总是报错,data为varchar型.错误提示: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 ' at line 1
String sql="delete from rizhi where `data`='" + data + "'";
varchar 型的值,需要用单引号包起来