ContextUtil.SetAbort 方法

定义

在 COM+ 上下文中将 consistent 位设置为 false,并将 done 位设置为 trueSets the consistent bit to false and the done bit to true in the COM+ context.

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

例外

没有可用的 COM+ 上下文。There is no COM+ context available.

示例

下面的代码示例演示如何使用此方法。The following code example demonstrates the use of this method.

// 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

注解

如果系统询问,上下文会投票中止当前事务,并在方法返回时停用该对象。If asked, the context votes to abort the current transaction, and the object is deactivated on method return.

适用于