views:

221

answers:

2

I'm trying to call a stored procedure from my .NET code which has one output paramater.

Its all standard ADO.NET stuff using SqlCommand, SqlParameter and so on. But I'm getting the error below even though my transaction level is READ COMMITTED.

You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels. Uncommittable transaction is detected at the end of the batch. The transaction is rolled back. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where

+2  A: 

Are you specifying NOLOCK with the READPAST hint? If so, its not going to work.

Why are you using READPAST in the first place (or NOLOCK if you are using it)?

Sam Saffron
I had never ever heard of ReadPast! And when I look at my transaction options all I'm doing is passing is setting the isolation level to ReadCommited and the timeout.When I run a sql trace theres no locking hints or anything!
AJM
+1  A: 

What Sam's getting at is that it's not your .NET code that's at fault - it's the stored procedure you're calling. Look in the SP for use of the READPAST hint.

John Saunders
Well done, my SP called another SP that used this hint. Cheers
AJM
Thanks, but my reason for mentioning Sam's name is that it was Sam's idea.
John Saunders
noted...............
AJM