IDalConnection.Commit

Syntax

Commit;

Description

The Commit method saves made changes within this transaction.

Comments

To initialize transaction, first execute the IDalConnection.StartTransaction method.

Example

Add links to the Dal system assembly.

Sub UserProc;
Var
    Driver: IDalDriver;
    Connect: IDalConnection;
    Command: IDalCommand;
    ConnectDesc: IDalConnectionDescriptor;
    ConnectDescParams: IDalConnectionDescriptorParams;
Begin
    Driver := New DalOrcl8Driver.Create;
    //Connection parameters
    ConnectDesc := Driver.CreateDescriptor;
    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 data saving
    Connect.Commit;
    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.

See also:

IDalConnection