Delen via


SqlTransaction.Save(String) Method

Definition

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

public:
 void Save(System::String ^ savePointName);
public:
 override void Save(System::String ^ savePointName);
public void Save (string savePointName);
public override void Save (string savePointName);
member this.Save : string -> unit
override this.Save : string -> unit
Public Sub Save (savePointName As String)
Public Overrides Sub Save (savePointName As String)

Parameters

savePointName
String

The name of the savepoint.

Exceptions

An error occurred while trying to commit the transaction.

The transaction has already been committed or rolled back.

-or-

The connection is broken.

Remarks

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.

Applies to