Root transaction wanted to commit, but transaction aborted

G

Guest

Hi All,

I have a .NET data access class that has TransactionOption.RequiresNew attribute set, and one of the functions has AutoComplete attribute set to True. The class is registered as a COM+ serviced component (through regsvcs). This function runs a stored procedure that takes 5 to 10 minutes. Through the profiler, I am able to trace this stored proc to completion. However, when control returns to the .NET function, an error "The root transaction wanted to commit, but transaction aborted" is raised.

1. The timeout is set to 0 (infinite).
2. The stored procedure uses no TRANSACTION statements.
3. There is no SetComplete()or SetAbort() in the code.
4. It runs fine without any errors if I run it from Query Analyzer.
5. It also runs properly if I use a simple SQLCommand without using this class.

Is there anything else I can do to see where the problem is?

Other details:

I am using Framework 1.1 under Windows 2003.

Thanks a ton for your help.
Karun.
 
S

Sam Santiago

Are you capturing exceptions within your call to the SP? AutoComplete votes
to commit ONLY if you exit your method normally. Do all your functions have
AutoComplete or only one? How about the others, are they explicitly doing a
SetComplete or SetAbort? AutoComplete can effect performance as well, so
you might want to explicitly control your transactions. Since you have
RequiresNew that should be the root transaction so perhaps an exception is
being thrown or somehow your function is not ending normally. Check out
this link:

http://msdn.microsoft.com/library/d...de/html/cpconvotinginautomatictransaction.asp


Good luck.
--
_______________________________
Sam Santiago
(e-mail address removed)

Karun Karunakaran said:
Hi All,

I have a .NET data access class that has TransactionOption.RequiresNew
attribute set, and one of the functions has AutoComplete attribute set to
True. The class is registered as a COM+ serviced component (through
regsvcs). This function runs a stored procedure that takes 5 to 10 minutes.
Through the profiler, I am able to trace this stored proc to completion.
However, when control returns to the .NET function, an error "The root
transaction wanted to commit, but transaction aborted" is raised.
 
G

Guest

Hi,
Thanks a lot for your reply. I am capturing exceptions in the call; I call the function within a Try-Catch block, but I don't get any exceptions ther, leading me to think that the SP completes normally and so does the function. I have only one function (call it Execute(strSQLString)) that is used for all database INSERTs/UPDATEs, and this is the one with Autocomplete set to True. Also, since I am able to trace the SP through the profiler and that does not give me any errors either.

Any more ideas?
Thanks,
Karun.
 

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