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

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

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

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

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

 

相关文章:

  • 2021-10-25
  • 2021-04-09
  • 2021-11-16
  • 2021-10-12
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
猜你喜欢
  • 2021-10-13
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
相关资源
相似解决方案