TransactionScope Error

T

tim

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.Coworker[k]);

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

coolCoder

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.Coworker[k]);

projectTableAdapter.Update(this.userDataSet.Project[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
 
T

tim

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 said:
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.Coworker[k]);

projectTableAdapter.Update(this.userDataSet.Project[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
 
N

nhminh76

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top