IfxTransaction example

The following example shows how to perform an insert within a local transaction. The command MyCommand.Transaction = myTrans; assigns the active transaction to the Transaction property of the IfxCommand object.

IfxConnection myConn = new IfxConnection("Host=ajax;Server=myServer; 
  Service=9401;database=dotnet;user id=xxx;password=xxx");
myConn.open();
IfxTransaction myTrans = myConn.BeginTransaction();
IfxCommand myCommand = new IfxCommand();
MyCommand.Transaction = myTrans;
MyCommand.CommandText = "INSERT INTO mytab(custid,custname) 
    values(1005,\"Name\");"
MyCommand.ExecuteNonQuery();
MyTrans.Commit();
MyConn.Close();