Can not issue data manipulation statements with executeQuery()

Can not issue data manipulation statements with executeQuery()spa

 

缘由是这句:st.executeQuery("insert  into  student  values('"+name+"','"+age+"','"+introduce+"')") ;.net

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

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

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

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

相关文章
相关标签/搜索