为了账号安全,请及时绑定邮箱和手机立即绑定

结果显示sql语句不对 不知道为什么 求解

结果显示sql语句不对 不知道为什么 求解

慕粉1469110649 2016-08-04 19:45:13
我写的部分代码 sb.append("select * from imooc_goddess where 1=1"); //sb.append(" where user_name like ? and mobile like ?"); if(params!=null &&params.size()>0){ for (int i = 0; i < params.size(); i++) { Map<String,Object> map=params.get(i); sb.append(" and "+map.get("name")+" "+map.get("rela")+" "+map.get("value")+" "); }显示结果select * from imooc_goddess where 1=1 and user_name = '小美'  and mobile = '18451922609' Exception in thread "main" com.mysql.jdbc.exceptions.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 '?€€ and mobile = '18451922609'?€€' at line 1  
查看完整描述

1 回答

?
ziom

TA贡献948条经验 获得超1109个赞

'小美'后面有一个中文空格

查看完整回答
1 反对 回复 2016-08-04
  • 1 回答
  • 0 关注
  • 2569 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信