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

我写的部分代码 

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

 


慕粉1469110649
浏览 2572回答 1
1回答

ziom

'小美'后面有一个中文空格
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
MySQL