sql 服务器的连接字符串中的 Enlist=false 是什么意思?
what is Enlist=false means in connection string for sql server?
我是 .net 的初学者。我遇到以下错误
"The transaction operation cannot be performed because there are pending requests working on this transaction.".
我在博客的某处阅读。我在连接字符串中附加了 enlist=true
,问题已解决。
注意:我正在将我的数据库从 sql 服务器 2005 升级到 sql 服务器 2008R2。
请帮助理解使用 enlist 的重要性。
的用户
The Connection object will automatically enlist in an existing
distributed transaction if it determines that a transaction is active.
Automatic transaction enlistment occurs when the connection is opened
or retrieved from the connection pool. You can disable auto-enlistment
in existing transactions by specifying Enlist=false
as a connection
string parameter for a SqlConnection, or OLE DB Services=-7 as a
connection string parameter for an OleDbConnection.
注意调用EnlistDistributedTransaction
前连接必须open
。
这里有一个例子 Enlist=False;
MSDN 说:
The ConnectionString property supports a keyword, Enlist, which
indicates whether System.Data.SqlClient will detect transactional
contexts and automatically enlist the connection in a distributed
transaction. If Enlist=true, the connection is automatically enlisted
in the opening thread's current transaction context. If Enlist=false,
the SqlClient connection does not interact with a distributed
transaction. The default value for Enlist is true. If Enlist is not
specified in the connection string, the connection is automatically
enlisted in a distributed transaction if one is detected when the
connection is opened.
我是 .net 的初学者。我遇到以下错误
"The transaction operation cannot be performed because there are pending requests working on this transaction.".
我在博客的某处阅读。我在连接字符串中附加了 enlist=true
,问题已解决。
注意:我正在将我的数据库从 sql 服务器 2005 升级到 sql 服务器 2008R2。
请帮助理解使用 enlist 的重要性。
The Connection object will automatically enlist in an existing distributed transaction if it determines that a transaction is active. Automatic transaction enlistment occurs when the connection is opened or retrieved from the connection pool. You can disable auto-enlistment in existing transactions by specifying
Enlist=false
as a connection string parameter for a SqlConnection, or OLE DB Services=-7 as a connection string parameter for an OleDbConnection.
注意调用EnlistDistributedTransaction
前连接必须open
。
这里有一个例子 Enlist=False;
MSDN 说:
The ConnectionString property supports a keyword, Enlist, which indicates whether System.Data.SqlClient will detect transactional contexts and automatically enlist the connection in a distributed transaction. If Enlist=true, the connection is automatically enlisted in the opening thread's current transaction context. If Enlist=false, the SqlClient connection does not interact with a distributed transaction. The default value for Enlist is true. If Enlist is not specified in the connection string, the connection is automatically enlisted in a distributed transaction if one is detected when the connection is opened.