asp.net.ph

SqlConnection.RollbackTransaction Method

System.Data.SqlClient Namespace   SqlConnection Class


Rolls back a database transaction from a pending state.

Overload List

1. Rolls back a transaction from being applied to the database.




2. Rolls back a database transaction with the transaction name.





Example

The following example initializes an SqlConnection, opens it, begins a transaction, rollsback the transaction, then closes the connection. To accomplish this, the method is passed an SQL connection string to use to connect to the data source.

NOTE: This example shows how to use one of the overloaded versions of RollbackTransaction. For other examples that may be available, see the individual overload topics.

void RunSqlTransaction ( string strConn ) {
   SqlConnection myConn = new SqlConnection ( strConn );
   myConn.Open ( );
   myConn.BeginTransaction ( "SampleTransaction" );
   myConn.RollbackTransaction ( "SampleTransaction" );
   myConn.Close ( );
}
See Also

SqlConnection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph