asp.net.ph

SqlConnection.SaveTransaction Method

System.Data.SqlClient Namespace   SqlConnection Class


Saves a point within the transaction that can be rolled back to.

[ VB ]
Public Sub SaveTransaction ( _
   ByVal savePointName As String _
)

[ C# ]
void SaveTransaction (
   string savePointName
);

[ C++ ]
public: void SaveTransaction (
   String* savePointName
);

[ JScript ]
public function SaveTransaction (
   savePointName : String
);

Parameters

savePointName
The name of the save point within the transaction.

Exceptions


Exception Type Condition
ArgumentException A save point name must be specified.

Remarks

The savePointName can be used in later calls to RollbackTransaction.

Example

The following example initializes an SqlConnection, opens it, begins a transaction, saves a point within the 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.

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

SqlConnection Members   CommitTransaction   RollbackTransaction   BeginTransaction 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