try {
          rs=db.executeQuery("select * from A where flag=1 ";);
          .... 
          db.execute("update A set flag=0 where flag=1");
          ...我想先取出某些满足条件的数据,然后把标志位置为0
可是A数据表里并没有被设置成0
这是为什么?求教

解决方案 »

  1.   

    public void test() {
    DB db = new DB();
    db.OpenConnection();
        try{
    String strSQL="update A set f=2 where f=1";
         db.execute(strSQL);
        }catch (Exception ex) {
        ex.printStackTrace();
        }finally {
         db.dbclose();
        }
            }即使是一个操作也不行?为什么啊
      

  2.   

    1,你用Statement里的executeUpdate看看的返回结果,是此操作影响的记录数。
    2,看看Connection里的getAutoCommit是不是返回true,否则要设为true或手工Connection.commit()一下
      

  3.   

    事物处理吧
    先把自动事物关掉
    自己COMMIT和ROLLBACK
      

  4.   

    execute?execute用来查询等操作的executeUpdate才是用来更新数据等操作用错语句了,用db.executeUpdate(String_SQLquery)试试吧