SqlTransaction.Save Method (String)

 

Creates a savepoint in the transaction that can be used to roll back a part of the transaction, and specifies the savepoint name.

Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public void Save(
	string savePointName
)

Parameters

savePointName
Type: System.String

The name of the savepoint.

Exception Condition
Exception

An error occurred while trying to commit the transaction.

InvalidOperationException

The transaction has already been committed or rolled back.

-or-

The connection is broken.

Save method is equivalent to the Transact-SQL SAVE TRANSACTION statement.

The value used in the savePoint parameter can be the same value used in the transactionName parameter of some implementations of the BeginTransaction method.

Savepoints offer a mechanism to roll back parts of transactions. You create a savepoint using the Save method, and then later call the Rollback method to roll back to the savepoint instead of rolling back to the start of the transaction.

.NET Framework
Available since 1.1
Return to top
Show: