12. Understanding .NET Data Provider Connectivity : .NET Data Provider Classes : IngresTransaction Class : IngresTransaction Class Example
 
Share this page                  
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();
}