System.Win.Mtsobj.TMtsAutoObject.SetAbort

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure SetAbort;

C++

void __fastcall SetAbort();

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Win.Mtsobj.pas
System.Win.Mtsobj.hpp
System.Win.Mtsobj TMtsAutoObject

Description

Allows the MTS Automation object to be deactivated and aborts any current transactions.

Call SetAbort to indicate that any current transaction that includes the MTS Automation object to abort. If MTS started a transaction automatically, the transaction aborts when the current method call exits. If the MTS Automation object was enlisted in a pre-existing transaction, the client transaction will eventually fail. Usually, SetAbort is called in the except block of a try...except statement.

In addition to aborting any current transaction, SetAbort indicates that the MTS Automation object can be deactivated when the current interface call exits. This means that state information is not preserved for the next time and the client calls the Automation object's interface. To prevent transactions from committing successfully without losing state information, use the DisableCommit method instead.

Tip: Call SetAbort at the beginning of a method to protect your MTS data module from committing prematurely in the event of an unexpected return. If the method call finishes normally, calling SetComplete reverses this affect and allows the transaction to complete.