Unknown column 'xxx' in 'where clause'错误

来源:互联网 发布:淘宝中的淘口令是什么 编辑:程序博客网 时间:2024/04/29 19:20
String sql = "select *from user where name= "+ name;

这样会报Unknown column ‘name’ in ‘where clause’错误

正确的写法应该为

String sql = "select *from user where name= '" + name + "'";
0 0
原创粉丝点击