首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

删除时遇到的有关问题

2012-02-04 
删除时遇到的问题strSql deletefromcustomerswhereid2 ConnectionmyConnection(Connection)DBConnec

删除时遇到的问题
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();也是报这个错。为什莫呢查了半天也没搞定,各位帮忙看下。

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

热点排行