如在客户端做增加,删除,修改等操作,如发生意外情况,
想在程序中处理,让数据回滚到未作增加,删除,修改前的状态,
应怎样写呢,谢谢各位了

解决方案 »

  1.   

    连接用TDatabase,有方法的
    void __fastcall TForm1::ApplyButtonClick(TObject *Sender){
      Database1->StartTransaction();
      try
      {
        CustomerQuery->ApplyUpdates(); // try to write the updates to the database
        Database1->Commit(); // on success, commit the changes;
      }
      catch (...)
      {
        Database1->Rollback(); // on failure, undo the changes
        throw; // throw the exception to prevent a call to CommitUpdates!
      }
      CustomerQuery->CommitUpdates(); // on success, clear the cache
    }
      

  2.   

    老兄,这里是Delphi啊,拜托用Delphi描述:database1.StartTransaction;
    try
      ...
      database1.Commit;
    except
      database1.rollback;
    end;
      

  3.   

    up~~~~~~~!---------------
    StartTransaction;
    try
      ...
      Commit;
    except
      rollback;
    end;
      

  4.   

    如果用ADO也一样吗???谢谢