AbortTransaction

ODBPPLib.IODBPP.AbortTransaction returns the current transaction to its original state, it could be the state at the beginning of the transaction or after the last CommitTransaction.
void AbortTransaction(
   bool releaseObjectLocks
);

Parameters

releaseObjectLocksif this is set to false, this method acts as an unsave point, undoing all adds, edits and deletes, but not releasing any object locks.

Return Values

Remarks

Example Use
  • C#
public static uint FIRST_TABLE = 1;
private void button1_Click(object sender, EventArgs e){
   try{
      ODBPPLib.ODBPP odbpp = new ODBPPLib.ODBPP();
      odbpp.OpenDatabase("C:\\My\\Database\\Control\\File.odc");
      odbpp.BeginTransaction(odbpp.SHARED, 60000);
      odbpp.OpenTable(FIRST_TABLE);
      while(true){
         ODBPPLib.DatabaseObject obj = odbpp.NewObject(FIRST_TABLE);
         obj.WriteField("First", 456);
         obj.WriteField("Second", 456.789);
         obj = odbpp.AddObject(FIRST_TABLE,0);
         if(obj.Id > 30){
            odbpp.AbortTransaction(true);
            break;
         }
         if(obj.Id > 25) break;
      }
      odbpp.CommitTransaction(true);
      odbpp.EndTransaction();
   }
   catch (Exception e1){
      MessageBox.Show(e1.Message);
   }
}

Also See

BeginTransaction, CommitTransaction, EndTransaction
Listen All
Comments (0)
Characters left: 2500
 
Ekky Software Homepage T-Accounts Online ObjectDatabase++ TScript Ekky Software Homepage T-Accounts Onlinee ObjectDatabase++ TScript