首页 > 其他 > 详细

Can not issue data manipulation statements with executeQuery()的解决方案

时间:2019-02-24 21:36:43      阅读:279      评论:0      收藏:0      [点我收藏+]

技术分享图片

 Can not issue data manipulation statements with executeQuery() 报错的解决方案:
把“ResultSet rs = statement.executeQuery(sql);”改成“boolean rs = statement.execute(sql);”就不会报错了。
原因是查询sql是把查询的结果都打印出来,修改更新(update)只需要判断是否执行成功,不需要打印结果,
所以这里不能用executeQuery()方法。

技术分享图片

上面打印的结果显示false,查看数据库的值已经被修改了。把“ statement.execute(sql)”改成

“ statement.executeUpdate(sql);”就可以啦~

 

Can not issue data manipulation statements with executeQuery()的解决方案

原文:https://www.cnblogs.com/changpuyi/p/10427963.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!