读书人

删除时遇到的有关问题

发布时间: 2012-02-04 15:43:08 作者: rapoo

删除时遇到的问题
strSql= "delete from customers where id=2 ";
Connection myConnection=(Connection)DBConnection.connectToDB();
PreparedStatement pStmt=null;
pStmt=myConnection.prepareStatement(strSql);
myConnection.setAutoCommit(false);

pStmt.execute();
myConnection.commit();
执行时报下面这个错:
Can not issue data manipulation statements with executeQuery().
可是我没有用executeQuery()啊,为什莫出这个错误呢。
改成pStmt.executeUpdate();也是报这个错。为什莫呢查了半天也没搞定,各位帮忙看下。

[解决办法]
错误信息完整点的说

读书人网 >Java Web开发

热点推荐