what is Enlist=false means in connection string for sql server?

前端 未结 2 452
耶瑟儿~
耶瑟儿~ 2021-01-12 02:58

I am a beginner with .net. I faced issue with the following error

\"The transaction operation cannot be performed because there are pending requests

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-12 03:26

    Enlisting is user for Distributed Transaction

    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.

    Note The Connection must be open before calling EnlistDistributedTransaction.

    Here is an example for you with Enlist=False;

提交回复
热议问题