Issue a command using an AseTransaction object.
For C#:
AseConnection conn = new AseConnection( c_connStr );
For Visual Basic .NET:
Dim conn As New AseConnection( _ c_connStr )
For C#:
conn.Open();
For Visual Basic .NET:
conn.Open()
For C#:
string stmt = "update product " + " set unit_price = 2000.00 " + " where name = 'Tee shirt'";
For Visual Basic .NET:
Dim stmt As String = "update product " + _ " set unit_price = 2000.00 " + _ " where name = 'Tee shirt'"
Using a transaction allows you to specify the isolation level. Isolation level 2 (RepeatableRead) is used in this example so that another database user cannot update the row:
For C#:
AseTransaction trans = conn.BeginTransaction( IsolationLevel.RepeatableRead ); AseCommand cmd = new AseCommand( stmt, conn, trans ); int rows = cmd.ExecuteNonQuery();
For Visual Basic .NET:
Dim trans As AseTransaction = _ conn.BeginTransaction( _ IsolationLevel.RepeatableRead ) Dim cmd As New AseCommand( _ stmt, conn, trans ) Dim rows As Integer = cmd.ExecuteNonQuery()
For C#:
trans.Rollback();
For Visual Basic .NET:
trans.Rollback()
The AseTransaction object allows you to commit or roll back your changes to the database. If you do not use a transaction, Adaptive Server ADO.NET Data Provider operates in autocommit mode and you cannot roll back any changes that you make to the database. To make the changes permanent, use:
For C#:
trans.Commit();
For Visual Basic .NET:
trans.Commit()
For C#:
conn.Close();
For Visual Basic .NET:
conn.Close()