0

There is a SP which gets over 96 items as parameters. I want to debug this sp, how can I do it?

It says:

Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0." System.Data.Common.DbException {System.Data.SqlClient.SqlException}

Please tell me a way to find this error? I will give more details the more answers come..

2 Answers 2

3

This SP will run properly:

BEGIN TRAN
...
COMMIT

But this:

BEGIN TRAN
...

or this:

...
COMMIT

will not!

Sign up to request clarification or add additional context in comments.

Comments

2

Forget about the number of parameters... start going through the code and counting the BEGIN entries as a +1 and COMMIT entries as a -1.. when you get to a place where your count is a -1, you found the error. Or, if you get to the end and your count isn't 0, there's your error. Every begin must have one commit.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.