I am trying to run the SQL Server procedure from C#:
try
{
ExecWithStoredProcedure("storedprocName @Message, @ProviderCode", message, providecode);
}
catch(Exception ex)
{
}
public int ExecWithStoredProcedure(string query, params object[] parameters)
{
return Context.Database.ExecuteSqlCommand(query, parameters);
}
But I am getting this error:
Message handler encountered an exception
System.Data.SqlClient.SqlException (0x80131904): Cannot roll back ORU_Trans. No transaction or savepoint of that name was found.Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 2.
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 2.
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 2.
I have tried to run the procedure manually and its running without error in SSMS, but while trying in C# code I am getting this error.