语言

ContextUtil.SetAbort 方法

定义

将 consistent 位设置为 false COM+ 上下文中的位和 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

注解

如果系统询问,上下文投票决定中止当前事务,并在方法返回时停用该对象。

适用于