Exception: ‘Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction’
This is hapening inside a SProc running on a machine having both SQL 2005 and Sql 2008 hosted.
The C# code looks something like this
(using TransactionScope t = new TransactionScope ()) { using(SqlConnection c= new SqlConnection(...)) { c.Open(); DataContext1 ctx = new DataContext1(c);//Linq2SQL c.StoreData(2,3);//Call Sproc } }
Sproc Looks like this
Select * Table where x=2 and y=3 if(@@rowcount =0) Insert into table values(2,3) end if
That error is due to a constraint failure on DB front. Your transaction is being rolled back (meaning nothing is happening to the database).
Basically, it’s an error occurring in a transaction that we can’t readily identify without more information. Post your query.