Home > Net >  In the.net TransactionScope transaction call a stored procedure
In the.net TransactionScope transaction call a stored procedure

Time:09-29

 
Using (var ts1=new TransactionScope ())
{
//method,,
//method 2,,
//call a stored procedure
ExecuteNonQuery ();

Ts1.Com plete ();
}


I call a stored procedure also have affairs, normal execution no problem, if the stored procedure a rollback occurs. Net background will quote "after the EXECUTE transaction counts the number of instructions BEGIN and COMMIT statement does not match, a count=1, the current count=0," wrong, if I put ExecuteNonQuery () method on the outside of the transaction can be normal execution, feeling like a TransactionScope problem happened inside, beg god for help and see what's the reason, thank you very much

CodePudding user response:

Suggest the BEGIN and COMMIT statement does not match the number of, it is really not match
If your stored procedure conditional branches, the branch testing all conditions

CodePudding user response:

TransactionScope I remember not Complete, if you Complete, within the Scope cannot be closed,

Of course not necessarily accurate, suggest you debug tracking,
  • Related