包含尝试捕获回滚模式的嵌套存储过程?
CREATE PROCEDURE [Name]ASBEGIN BEGIN TRANSACTION BEGIN TRY [...Perform work, call nested procedures...] END TRY BEGIN CATCH ROLLBACK TRANSACTION RAISERROR [rethrow caught error using @ErrorNumber, @ErrorMessage, etc] END CATCHEND
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.
@@TRANCOUNT
try{
var context = new MyDataContext();
using (var transaction = new TransactionScope())
{
// Some Linq stuff
context.SubmitChanges();
context.MyStoredProcedure();
transactionComplete();
}}catch{
// An error occured!}墨色风雨
慕神8447489
相关分类