问题描述
我正在尝试对链接服务器(链接到Sybase的SQL Server 2008)执行查询,然后将其选择到临时表中.通过SQL Management Studio中的查询窗口可以完美地工作,但是当我通过代码(C#)进行操作时,它失败并显示错误由于链接服务器"MYLINKEDSERVER"的OLE DB提供程序"ASEOLEDB"而无法执行该操作,因此无法执行该操作开始分布式事务.我没有在我的DbConnection中使用代码中的事务.
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.
此查询如下:
SELECT *
INTO #temptable
FROM OPENQUERY([MYLINKEDSERVER], 'SELECT * from table')
推荐答案
发现了问题.这是连接池的结果.似乎连接被重用,导致系统认为正在发生分布式事务.
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.
这篇关于仅通过代码进行分布式事务处理错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!