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 (string savePointName);

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

מוצר גירסאות
.NET Core 1.0, Core 1.1, 6 (package-provided), 8 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

See also