9. Understanding .NET Data Provider Connectivity : .NET Data Provider Classes : IngresTransaction Class
 
Share this page                  
IngresTransaction Class
The IngresTransaction class represents a local, non-distributed database transaction. Each connection is associated with a transaction. This object allows manual commit or rollback control over the pending local transaction.
Created by the BeginTransaction method in the IngresConnection object. After Commit() or Rollback has been issued against the transaction, the IngresTransaction object can not be reused and a new IngresTransaction object must be obtained from the IngresConnection.BeginTransaction method if another transaction is desired.
IngresTransaction Class Declaration
The IngresTransaction class declaration is as follows:
C#: public sealed class IngresTransaction : System.Data.Common.DbTransaction
VB.NET: NotInheritable Public Class IngresTransaction
Inherits System.Data.Common.DbTransaction
IngresTransaction Class Example
The following is an implementation of the IngresTransaction class:
static void DemoTxn(string connstring)
{
    IngresConnection conn = new IngresConnection(connstring);
    ProviderTransaction txn;

    conn.Open();
    txn = conn.BeginTransaction();

    IngresCommand cmd = new IngresCommand(
        "update demo_personnel set name = 'Howard Lane' "+
        " where number = 200", conn, txn);

    int numberOfRecordsAffected = cmd.ExecuteNonQuery();

    Console.WriteLine(numberOfRecordsAffected.ToString() +
        " records updated.");

    txn.Commit();

    conn.Close();
}
IngresTransaction Class Properties
The IngresTransaction class has the following properties:
Property
Accessor
Description
Connection
get
The IngresConnection object that is associated with the transaction. Null if the transaction or connection is no longer valid.
IsolationLevel
get
The IsolationLevel for this transaction as set in the IngresConnection.BeginTransaction method.
IngresTransaction Class Methods
The IngresTransaction class contains the following methods:
Method
Description
Commit
Commit the database changes.
Dispose
Release allocated resources.
Rollback
Rollback the database changes.