Can not issue data manipulation statements with executeQuery()

Posted xiaodongxiaodong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Can not issue data manipulation statements with executeQuery()相关的知识,希望对你有一定的参考价值。

Can not issue data manipulation statements with executeQuery()

 

原因是这句:st.executeQuery("insert  into  student  values(‘"+name+"‘,‘"+age+"‘,‘"+introduce+"‘)") ;

我是看了书上一个例子,然后开始模仿,发现问题后,发现书上其他程序语句都是用这句,

后来看了几个网页,才明白这句应该该成这样子:st.execute("insert  into  student  values(‘"+name+"‘,‘"+age+"‘,‘"+introduce+"‘)") ;

最后总结:如果你的SQL 语句是诸如update,insert的更新语句,应该用statement的execute()方法,如果用的是statement的executeQuery()就会出现上诉问题

转自:https://blog.csdn.net/cherishme1988/article/details/7399225

以上是关于Can not issue data manipulation statements with executeQuery()的主要内容,如果未能解决你的问题,请参考以下文章

java sql SQLException Can not issue data manipulation statem

Can not issue data manipulation statements with executeQuery() 异常处理

java.sql.SQLException: Can not issue data manipulation statements with execu 这是错误提示

Eclipse运行自动化脚本报错: invalid element state: Element is not currently interactable and may not be manipu

MB Star troubleshot Mercedes VITO can not drive issue

Caused by java sql BatchUpdateException Can not issue exec