Trouble executing a MySQL delete statement in Java

后端 未结 6 1842
旧时难觅i
旧时难觅i 2021-01-14 12:41

I am trying to have this code run and delete a certain record in a MySQL database but I get this error:

SQLException: Can not issue data manipulation stateme         


        
6条回答
  •  死守一世寂寞
    2021-01-14 13:16

    You use executeUpdate() for that instead.

    executeQuery() is only for statements that return data. executeUpdate is for ones that won't return date (update, insert, delete, and I believe things like adding/dropping tables, constraints, triggers, and the like as well).

提交回复
热议问题