//from Delphi help
procedure TForm1.ApplyButtonClick(Sender: TObject);begin
  with CustomerQuery do
  begin
  Database1.StartTransaction;
    try
      ApplyUpdates; {try to write the updates to the database};
      Database1.Commit; {on success, commit the changes};
    except
      Database1.Rollback; {on failure, undo the changes};
    raise; {raise the exception to prevent a call to CommitUpdates!}
    end;
  CommitUpdates; {on success, clear the cache}
  end;end;

解决方案 »

  1.   

    frmmain.Database1.StartTransaction;
    try
    ..........
    except
    frmmain.Database1.Rollback;
    raise;
    end;
      

  2.   

    frmmain.Database1.StartTransaction;
    try
    ..........
    except
    frmmain.Database1.Rollback;
    raise;
    end;
      

  3.   

    //ADO方式
      try
        ADOConnection1.BeginTrans;
        ADOQuery1.UpdateBatch;
        ADOQuery2.UpdateBatch;
        ADOConnection1.CommitTrans;
      except
        ADOConnection1.RollbackTrans;
      end;
      

  4.   

    http://www.csdn.net/expert/topic/554/554021.xml
    帮我看看好吗?
      

  5.   


      frmmain.Database1.StartTransaction;
      try
      ..........
      except
      frmmain.Database1.Rollback;
      raise;
      end; 
     
      //ADO方式
          try
              ADOConnection1.BeginTrans;
              ADOQuery1.UpdateBatch;
              ADOQuery2.UpdateBatch;
              ADOConnection1.CommitTrans;
          except
              ADOConnection1.RollbackTrans;
          end;
       
      

  6.   

    帮我看看谢谢大家,我开发的是ISAPI 这里没说清楚http://www.csdn.net/expert/topic/554/554021.xml
      

  7.   

    帮我看看谢谢大家,我开发的是ISAPI 这里没说清楚http://www.csdn.net/expert/topic/554/554021.xml