ContextUtil.SetAbort 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在 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
備註
若被要求,上下文會投票中止當前交易,且物件在方法回傳時被停用。