Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Transactions and .NET

Author  Topic 

jackstow
Posting Yak Master

160 Posts

Posted - 2002-02-28 : 05:10:13
I have a stored procedure that has always worked with an ASP page and still does, but when I run it from an ASP.NET page I get the following error;

System.Data.SqlClient.SqlException: The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.

.. well the ROLLBACK TRANSACTION does have a corresponding BEGIN TRANSACTION , always has had and it always worked.
Does .NET handle transactions differently? As this transaction was within a stored procedure anyway with nothing about it on the page I would have thought it should work.

nr
SQLTeam MVY

12543 Posts

Posted - 2002-02-28 : 05:29:11
I would guess that you are trying to roll back the transaction in asp but have already rolled it back in the sp.

a situation similar to this which will get the error.

create procedure #test
as
begin tran
rollback tran
go


begin tran
exec #test
rollback tran


==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jackstow
Posting Yak Master

160 Posts

Posted - 2002-02-28 : 05:49:27
No I'm just running it from the asp.net page thats all.

Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-02-28 : 07:36:40
Can you post the code of your Sp and Asp.Net Sp execution code.



--------------------------------------------------------------
Go to Top of Page

Onamuji
Aged Yak Warrior

504 Posts

Posted - 2002-02-28 : 08:31:39
I have always found it best to manage transaction in ASP|ASP.NET rather than at the procedure level (for procedures for jobs and such transaction can be left in the procedure). This allows you to call multiple procedures (say you're inserted items into a table via a procedure) and if any one of them fail rollback all, vs only rolling back the one that fails.

Try removing the transaction data from the procedure and use the SqlTransaction object in .NET ... if that doesn't work ... well tell us ... it should work though, I've used it hundreds of times already... oh and make sure you are running Version 1 of the framework and not a beta

- Onamuji
Go to Top of Page
   

- Advertisement -