Share via


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

備註

如果系統詢問,內容會投票中止目前的交易,並在方法傳回時停用物件。

適用於