TSQL try catch transaction error handling, transaction count mismatch
问题 I have a sproc that I am calling from C# with a transaction by doing: using (var dbContext = PowerToolsDatabase.GetDataContext()) { dbContext.Connection.Open(); using (dbContext.Transaction = dbContext.Connection.BeginTransaction(System.Data.IsolationLevel.Serializable)) { foreach (var element in package.AddOrUpdateElements) { dbContext.usp_Element_Commit( /* args */); } dbContext.Transaction.Commit(); } } And in that sproc there is a try catch, and a RAISERROR inside the try part that is