Title: Distributed Transaction Error Only Through Code
Tags: c#;.net;transactions;linked-server
Question: 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')
Comment: Is MSDTC configured the same for all machines involved in the distributed transaction? Are the [permissions](http://blogs.msdn.com/b/distributedservices/archive/2009/03/13/troubleshooting-msdtc-permission-issues-when-a-distributed-transaction-starts.aspx) all correct?

Here is the accepted answer: 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.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 2.5', 'CreationDate': '2010:00:11/17/10', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c#><.net><transactions><linked-server>', 'Title': 'Distributed Transaction Error Only Through Code', 'ViewCount': 1027, 'id': 4205484, 'user_AboutMe': 'Software Developer in .NET', 'user_AccountId': 14857.0, 'user_DisplayName': 'ctrlalt313373', 'user_Reputation': 3757.0, 'user_Views': 372.0, 'user_id': 30889.0}}