Can not issue data manipulation statements with executeQuery()错误解决
生活随笔
收集整理的這篇文章主要介紹了
Can not issue data manipulation statements with executeQuery()错误解决
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?
轉(zhuǎn):
?
Can not issue data manipulation statements with executeQuery()錯誤解決
2012年03月27日 15:47:52 katalya 閱讀數(shù):79830 標(biāo)簽: insert 數(shù)據(jù)庫 sql 版權(quán)聲明:本文為博主原創(chuàng)文章,未經(jīng)博主允許不得轉(zhuǎn)載。 https://blog.csdn.net/cherishme1988/article/details/7399225?強(qiáng)烈建議:盡信書,不如無書!!!?
?
下午沒事,就練習(xí)了下連接數(shù)據(jù)庫,結(jié)果發(fā)現(xiàn)了一個問題,哈哈
Can not issue data manipulation statements with executeQuery()
?
原因是這句:st.executeQuery("insert? into? student? values('"+name+"','"+age+"','"+introduce+"')") ;
我是看了書上一個例子,然后開始模仿,發(fā)現(xiàn)問題后,發(fā)現(xiàn)書上其他程序語句都是用這句,
后來看了幾個網(wǎng)頁,才明白這句應(yīng)該該成這樣子:st.execute("insert? into? student? values('"+name+"','"+age+"','"+introduce+"')") ;
最后總結(jié):如果你的SQL 語句是諸如update,insert的更新語句,應(yīng)該用statement的execute()方法,如果用的是statement的executeQuery()就會出現(xiàn)上訴問題轉(zhuǎn)載于:https://www.cnblogs.com/libin6505/p/10757309.html
總結(jié)
以上是生活随笔為你收集整理的Can not issue data manipulation statements with executeQuery()错误解决的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Bootstrap table 行编辑导
- 下一篇: 常见的数学记号