Suppose sDB2ConnectionString is the string that you use to connect to DB2.
The isolation level is specified in the transaction, but the Transaction.IsolationLevel property is read-only. You can install it only when creating a transaction.
For simplicity, I used a call to a stored procedure with no parameters. Of course, you can use any type of DB2Command as part of a transaction.
// string sDB2ConnectionString = ConfigurationManager.AppSettings[environment + "_ConnectionString"]; using ( DB2Connection conn = new DB2Connection( sDB2ConnectionString ) ) { conn.Open(); using ( DB2Transaction tran = conn.BeginTransaction( IsolationLevel.ReadUncommitted ) ) { using ( DB2Command dbCommand = conn.CreateCommand() ) { dbCommand.Transaction = tran; dbCommand.CommandType = CommandType.StoredProcedure; dbCommand.CommandText = "MySchema.MyStoredProcedureName"; dbCommand.ExecuteNonQuery(); tran.Commit(); } } }
source share