What is Enlist = false means a connection string for SQL Server?

I start with .net. I ran into a problem with the following error

"The transaction operation could not be completed because requests are expected to process this transaction."

I read somewhere on the blog. I added a connection string with enlist=true , and the problem was resolved.

Note I am upgrading my database from SQL Server 2005 to SQL Server 2008R2.

Please help understand the importance of using enrollment.

+5
source share
2 answers

Enabling User for Distributed Transaction

The Connection object will automatically close in the existing one if it determines that the transaction is active. Automatic transaction entry occurs when a connection is open or retrieved from the connection pool. You can disable automatic recruiting in existing transactions by specifying Enlist=false as the connection string for SqlConnection or OLE DB Services = -7 as the connection string parameter for OleDbConnection.

Note The connection must be open before calling EnlistDistributedTransaction .

Below is an example for Enlist=False;

+7
source

MSDN says:

The ConnectionString property supports the Enlist keyword, which indicates whether System.Data.SqlClient will detect transactional contexts and automatically connect the connection in a distributed transaction. If Enlist = true , the connection is automatically credited in the context of the current transaction to open the stream. If Enlist = false , the SqlClient connection does not interact with the distributed transaction. The default value for Enlist is true. If the Enlist is not specified in the connection string, the connection is automatically credited to the distributed transaction if it is detected when the connection is opened.

+2
source

Source: https://habr.com/ru/post/1244181/


All Articles