Distributed Transaction Error Only Through Code

倖福魔咒の 提交于 2019-12-11 05:01:54

问题


I and trying to perform a query against a linked server (SQL Server 2008 linked to Sybase) and select it into a temp table. Is works perfectly though a query window in SQL Management Studio, but when I do it through code (C#) it fails with the error "The operation could not be performed because OLE DB provider "ASEOLEDB" for linked server "MYLINKEDSERVER" was unable to begin a distributed transaction. I am not using a transaction in code with my DbConnection.

This query looks like this:

SELECT * 
INTO #temptable
FROM OPENQUERY([MYLINKEDSERVER], 'SELECT * from table')

回答1:


Found the issue. It was a result of connection pooling. It appears that connections were getting reused causing the system to think there was a distributed transaction happening.



来源:https://stackoverflow.com/questions/4205484/distributed-transaction-error-only-through-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!