I begin transaction as here
this.cmd.Transaction = (await this.cmd.Connection.BeginTransactionAsync(IsolationLevel.Snapshot)) as SqlTransaction;
Then i tried to Commit transaction using
cmd.CommandText = "COMMIT TRAN";
await cmd.ExecuteNonQueryAsync();
The program throws an exeption "Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0" What is the problem, and why i can't commit transaction such this?
With
cmd.Transaction.CommitAsync()
it works.