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刪除。



猜您在找 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 【異常】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 報錯--->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 mybatis的報錯____3Error updating database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right 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 '11. set password for 'root'@'localhost' 修改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 ' MySQL check the manual that corresponds to your MySQL server version for the right syntax錯誤 【報錯】ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds t check the manual that corresponds to your MySQL server version for the right syntax to use near '(0) NULL DEFAULT NULL COMMENT
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM