mybatis中的limit参数
参数page=1,rows=3错误写法:select * from xxx limit #{page},#{rows}报错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use ne
·
参数page=1,rows=3
错误写法:select * from xxx limit #{page},#{rows}
报错:
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 ''1','3'' at line 1
可以看出mybatis自动给我们的参数加了 引号 ' ',所以报错
解决方法:#{}改为${}
正确写法:select * from xxx limit ${page},${rows}
更多推荐
已为社区贡献1条内容
所有评论(0)