MySql 执行语句错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to usenear 'bookName like '%Java%'' at line 1


运行程序,执行多条件查询时报错:

com.mysql.jdbc.exceptions.jdbc4.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 'bookName like '%Java%'' at line 1

 报错的原因是sql语句语法错误:检查与mysql服务器版本相对应的手册的正确语法。

现展示代码中的sql语句:

程序报错后先查看控制台,找出异常或错误的位置和原因,这次报错的根本原因是sql语法错误,所以找到sql语句检查即可,我这里的2行sql语句是要进行拼接使用的,因为在浏览器页面要进行多条件查询时使用,程序刚开始运行时没有错,但后来因为手欠把图中标注的地方的sql语句空格给取消了,害的我花了好长时间才找到原因,不过也挺开心的,因此犯了一个错误也因此又掌握了一个知识点,其实写程序就是在不断报错不断修改调错的过程中提高自身技术水平的,这个知识点我会永远记着不会再忘了,因为调错太花时间了

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 MySql 执行语句错误 Err] 1064 - 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 解决:[Err] 1064 - 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 ERROR 1064 (42000): 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 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 '"id", 【异常】MySQL建表报错: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 '"order"' at line 1 1064 - 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 'groups)VALUES('1','hh','hh@163.com','Boss')' at line 1 SQL语句报错:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near Django进行数据迁移时,报错:(1064, "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 '(6) NOT NULL)' at line 1") 报错--->java.sql.SQLSyntaxErrorException: 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 'delect from testd Mysql语法错误之> 1064 - 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'
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM