Problem to debug stored procedure
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. P开发者_运维百科revious 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..
This SP will run properly:
BEGIN TRAN
...
COMMIT
But this:
BEGIN TRAN
...
or this:
...
COMMIT
will not!
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.
精彩评论