0
Answer

TableAdapters And TransactionScope

taner gurel

taner gurel

17y
4.5k
1

Hi i have a problem about transactionscope when i tried to use in a transactionscope two tableadapter updates than I have an error about MSDTC and always the error is in the second tableadapters connection.open clouse.I tried to do the settings of the MSDTC but I'm not sure that I was succeeded.It's ok on local but when I try to connect to the server this happens.I'm using VS2005 and on the server SQL Server 2005.

My code is like that

TransactionOptions options = new TransactionOptions();

options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;

options.Timeout = new TimeSpan(0, 2, 0);

using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))

{

TableAdapter1 TA1=new TableAdapter1();

TableAdapter2 TA2=new TableAdapter2();

TA1.Update();

TA2.Update();   /* I always have this error 'connection.open'  in the second one if I change the places of TA1 and TA2  then the error is in TA1*/

scope.Complete();

}

 

Thanks for helping...