語言

ContextUtil.SetAbort 方法

定義

在 COM+ 情境中,將位元設consistent為 ,false位done元為 。true

public:
 static void SetAbort();
public static void SetAbort();
static member SetAbort : unit -> unit
Public Shared Sub SetAbort ()

例外狀況

目前沒有 COM+ 的上下文。

範例

以下程式碼範例示範此方法的使用。

// Commit or abort the transaction 
if (AllowCommit)
{
    ContextUtil::SetComplete();
}
else
{
    ContextUtil::SetAbort();
}
// Commit or abort the transaction
if (commit)
{
    ContextUtil.SetComplete();
}
else
{
    ContextUtil.SetAbort();
}
' Commit or abort the transaction 
If commit Then
    ContextUtil.SetComplete()
Else
    ContextUtil.SetAbort()
End If

備註

若被要求,上下文會投票中止當前交易,且物件在方法回傳時被停用。

適用於