IDalConnection.Rollback

Syntax

Rollback;

Description

The Rollback method cancels the changes made within this transaction.

Example

Sub UserProc;
Var
    Driver: IDalDriver;
    Connect: IDalConnection;
    Command: IDalCommand;
    ConnectDesc: IDalConnectionDescriptor;
    ConnectDescParams: IDalConnectionDescriptorParams;
Begin
    Driver := New DalOrcl8Driver.Create;
    ConnectDesc := Driver.CreateDescriptor;
    //Connection parameters
    ConnectDescParams := ConnectDesc.Params;
    ConnectDescParams.Find("User Name").Value := "User";
    ConnectDescParams.Find("Password").Value := "Password";
    ConnectDescParams.Find("Host BSTR").Value := "OrclServer";
    ConnectDescParams.Find("Schema").Value := "Repository";
    //Create  a connection
    Connect := ConnectDesc.CreateConnection;
    Command := Connect.CreateCommand;
    //Command
    Command.SQL := "Insert Into DataTable Values ('AA','BB',11,22,'12.12.2008')";
    Connect.StartTransaction;
    //Execute command
    Command.Execute;
    //Finish transaction with rollback of changes
    Connect.Rollback;
    Command.Close;
    Connect.Close;
End Sub UserProc;

On executing the example the repository connection is established with specified location parameters. After that the transaction is initialized, and the SQL query is executed, a new record is added to the DataTable table. Then made changes are canceled.

See also:

IDalConnection