HighTechTalks DotNet Forums  

TransactionScope Error

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss TransactionScope Error in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
tim
 
Posts: n/a

Default TransactionScope Error - 11-28-2007 , 05:53 AM






I wrap two updates from different tableadapters in a transactionscope. They
are connected to the same databese. By runing the program I get an error
message: Communication with the underlying transaction manager has failed.
Error HRESULT E_FAIL has been returned from a call to a COM component.

The code:
using (TransactionScope scope = new TransactionScope())
{

coworkerTableAdapter.Update(this.userDataSet.Cowor ker[k]);

projectTableAdapter.Update(this.userDataSet.Projec t[t]);
scope.Complete();
}
What can be the reason?
If I update only one table it works without problems.

Reply With Quote
  #2  
Old   
coolCoder
 
Posts: n/a

Default Re: TransactionScope Error - 11-28-2007 , 06:45 AM






On Nov 28, 3:53 pm, tim <t... (AT) discussions (DOT) microsoft.com> wrote:
Quote:
I wrap two updates from different tableadapters in a transactionscope. They
are connected to the same databese. By runing the program I get an error
message: Communication with the underlying transaction manager has failed.
Error HRESULT E_FAIL has been returned from a call to a COM component.

The code:
using (TransactionScope scope = new TransactionScope())
{

coworkerTableAdapter.Update(this.userDataSet.Cowor ker[k]);

projectTableAdapter.Update(this.userDataSet.Projec t[t]);
scope.Complete();
}
What can be the reason?
If I update only one table it works without problems.
Hi tim,
Do you have access to the database server ? I mean to say,
check whether MSDTC is enabled on database server machine and on your
machine too.

It is accessible through following path --

Control Panel --> Administrative Tools --> Component
Services --> Component Services --> Computers
Now right click on My Computer and click on properties. Go
to MSDTC tab. Click Security Configuration

Now you just check all check boxes leaving the Enable XA
Transactions. Leave everything else as it is.

I hope that this works for you. I had a similar problem,
which was solved by enabling MSDTC on server and my machine.

In case of any problems, please revert back.


Thanks,
coolCoder

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you find this post helpful, please rate it.


Reply With Quote
  #3  
Old   
tim
 
Posts: n/a

Default Re: TransactionScope Error - 11-28-2007 , 11:34 AM



Hi coolCoder,

Thanks for the answer.

MS DTC was enabled and configured like described by MSDN. By updating of one
table it works all right. The error appears by updating two or more tables in
the database.

tim



"coolCoder" wrote:

Quote:
On Nov 28, 3:53 pm, tim <t... (AT) discussions (DOT) microsoft.com> wrote:
I wrap two updates from different tableadapters in a transactionscope. They
are connected to the same databese. By runing the program I get an error
message: Communication with the underlying transaction manager has failed.
Error HRESULT E_FAIL has been returned from a call to a COM component.

The code:
using (TransactionScope scope = new TransactionScope())
{

coworkerTableAdapter.Update(this.userDataSet.Cowor ker[k]);

projectTableAdapter.Update(this.userDataSet.Projec t[t]);
scope.Complete();
}
What can be the reason?
If I update only one table it works without problems.

Hi tim,
Do you have access to the database server ? I mean to say,
check whether MSDTC is enabled on database server machine and on your
machine too.

It is accessible through following path --

Control Panel --> Administrative Tools --> Component
Services --> Component Services --> Computers
Now right click on My Computer and click on properties. Go
to MSDTC tab. Click Security Configuration

Now you just check all check boxes leaving the Enable XA
Transactions. Leave everything else as it is.

I hope that this works for you. I had a similar problem,
which was solved by enabling MSDTC on server and my machine.

In case of any problems, please revert back.


Thanks,
coolCoder

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you find this post helpful, please rate it.


Reply With Quote
  #4  
Old   
nhminh76
 
Posts: n/a

Default Re: TransactionScope Error - 12-05-2007 , 09:19 PM



I have same problem, I use "using" keyword in each update to sure connection
close properly. MS DTC was enabled too

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.