// System.Data.SqlClient.SqlTransaction
public override void Rollback()
{
    if (this.IsYukonPartialZombie)
    {
        if (Bid.AdvancedOn)
        {
            Bid.Trace("<sc.SqlTransaction.Rollback|ADV> %d# partial zombie no rollback required\n", this.ObjectID);
        }
        this._internalTransaction = null;
        return;
    }
    this.ZombieCheck();
    SqlStatistics statistics = null;
    IntPtr intPtr;
    Bid.ScopeEnter(out intPtr, "<sc.SqlTransaction.Rollback|API> %d#", this.ObjectID);
    SNIHandle target = null;
    RuntimeHelpers.PrepareConstrainedRegions();
    try
    {
        target = SqlInternalConnection.GetBestEffortCleanupTarget(this._connection);
        statistics = SqlStatistics.StartTimer(this.Statistics);
        this._isFromAPI = true;
        this._internalTransaction.Rollback();
    }
    catch (OutOfMemoryException e)
    {
        this._connection.Abort(e);
        throw;
    }
    catch (StackOverflowException e2)
    {
        this._connection.Abort(e2);
        throw;
    }
    catch (ThreadAbortException e3)
    {
        this._connection.Abort(e3);
        SqlInternalConnection.BestEffortCleanup(target);
        throw;
    }
    finally
    {
        this._isFromAPI = false;
        SqlStatistics.StopTimer(statistics);
        Bid.ScopeLeave(ref intPtr);
    }
}

// System.Data.SqlClient.SqlInternalTransaction
internal void Rollback()
{
    IntPtr intPtr;
    Bid.ScopeEnter(out intPtr, "<sc.SqlInternalTransaction.Rollback|API> %d#", this.ObjectID);
    if (this._innerConnection.IsLockedForBulkCopy)
    {
        throw SQL.ConnectionLockedForBcpEvent();
    }
    this._innerConnection.ValidateConnectionForExecute(null);
    try
    {
        this._innerConnection.ExecuteTransaction(SqlInternalConnection.TransactionRequest.IfRollback, null, IsolationLevel.Unspecified, null, false);
        this.Zombie();
    }
    catch (Exception e)
    {
        if (!ADP.IsCatchableExceptionType(e))
        {
            throw;
        }
        this.CheckTransactionLevelAndZombie();
        if (!this._disposing)
        {
            throw;
        }
    }
    finally
    {
        Bid.ScopeLeave(ref intPtr);
    }
}

// System.Data.SqlClient.SqlInternalConnectionTds
internal override void ExecuteTransaction(SqlInternalConnection.TransactionRequest transactionRequest, string name, IsolationLevel iso, SqlInternalTransaction internalTransaction, bool isDelegateControlRequest)
{
    if (base.IsConnectionDoomed)
    {
        if (transactionRequest == SqlInternalConnection.TransactionRequest.Rollback || transactionRequest == SqlInternalConnection.TransactionRequest.IfRollback)
        {
            return;
        }
        throw SQL.ConnectionDoomed();
    }
    else
    {
        if ((transactionRequest == SqlInternalConnection.TransactionRequest.Commit || transactionRequest == SqlInternalConnection.TransactionRequest.Rollback || transactionRequest == SqlInternalConnection.TransactionRequest.IfRollback) && !this.Parser.MARSOn && this.Parser._physicalStateObj.BcpLock)
        {
            throw SQL.ConnectionLockedForBcpEvent();
        }
        string transactionName = (name == null) ? string.Empty : name;
        if (!this._parser.IsYukonOrNewer)
        {
            this.ExecuteTransactionPreYukon(transactionRequest, transactionName, iso, internalTransaction);
            return;
        }
        this.ExecuteTransactionYukon(transactionRequest, transactionName, iso, internalTransaction, isDelegateControlRequest);
        return;
    }
}

为什么SqlTransaction.Rollback会抛出SqlException(11,-2)(即SQL超时异常)的更多相关文章

  1. 页面打开 抛出w3wp.exe 中发生未处理异常

    页面打开 抛出w3wp.exe 中发生未处理异常

  2. HttpClient连接池抛出大量ConnectionPoolTimeoutException: Timeout waiting for connection异常排查

    转自: http://blog.csdn.net/shootyou/article/details/6615051 今天解决了一个HttpClient的异常,汗啊,一个HttpClient使用稍有不慎 ...

  3. 1:MUI选择器组件抛出“n.getSelectedItem is not a function”异常的解决办法 2:mui三级联动 3:移动端关闭虚拟键盘

    1:如下图 问题:引用了mui的地址选择的三级联动的应用在h5上的组件 百度发现别人思路对 Array 原型链方法扩充时,会抛出这个异常. 修改方法: mui.poppicker.js 第 112 行 ...

  4. pytest执行用例时从conftest.py抛出ModuleNotFoundError:No module named 'XXX'异常的解决办法

    一.问题描述 在项目根目录下执行整个测试用例,直接从conftest.py模块中抛出了ModuleNotFoundError:No module named 'TestDatas'的异常: 二.解决方 ...

  5. 从constructor中抛出exception后,constructor会返回null吗?

    刚才琢磨这个问题主要是在想,如果constructor抛出了exception,那么返回的object是什么一个情况呢?如果我这个object中有一些关键的资源没有初始化,比如说Database co ...

  6. Java中,异常的处理及抛出

    首先我们需要知道什么是异常? 常通常指,你的代码可能在编译时没有错误,可是运行时会出现异常.比如常见的空指针异常.也可能是程序可能出现无法预料的异常,比如你要从一个文件读信息,可这个文件不存在,程序无 ...

  7. PLSQL_Oracle Exception异常分类、异常抛出、异常处理、异常传播(概念)

    2014-06-03 Created By BaoXinjian

  8. java——异常类、异常捕获、finally、异常抛出、自定义异常

    编译错误:由于编写程序不符合程序的语法规定而导致的语法问题. 运行错误:能够顺利的编译通过,但是在程序运行过程中产生的错误. java异常类都是由Throwable类派生而来的,派生出来的两个分支分别 ...

  9. java的异常抛出throws和throw的简单使用

    前提: 当在程序测试时,如果你需要定义一个自己的异常,而非现在已经存在的异常,这个时候你需要用到throws和throw,try-catch只是一个简单的捕获异常的过程. 代码如下: package ...

随机推荐

  1. 腾讯优测优分享 | Android适配中的一些特殊情况小结

    腾讯优测是专业的自动化测试平台,提供全面兼容适配测试,远程真机租用等多维度的测试服务! 作为一名"艰苦卓绝"的软件工程师,我在开发路上经常被各种奇葩情况虐的体无完肤...今天就想与 ...

  2. ActiveMQ的初夜

    Producer Flow Control mq自己实现了Flow Control(流量控制,默认开启),在mq的版本中,4.x和5.x流量控制实现原理并不相同,前者通过 TCP Flow Contr ...

  3. linux的一些与关机和重启相关的命令

    runlevel 查看系统级别 cat /etc/inittab 修改系统默认运行级别 logout 退出登录

  4. Hot code replace failed

    今天在eclipses中 修改代码,保存时会出时不时出现Hot code replace failed 对话框,谷歌提示是在debug模式下保存修改源代码会出现此类问题.确实,刚刚在用debug功能, ...

  5. ubuntu更新命令点点滴滴

    ubuntu更新命令点点滴滴      一些非root的更新命令:              sudo: sudo是linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部的root命令的一 ...

  6. iOS 传值 委托(delegate)和block 对比

     技术交流新QQ群:414971585 这篇文章建议和前一篇一起看, 另外先弄清楚IOS的block是神马东东. 委托和block是IOS上实现回调的两种机制.Block基本可以代替委托的功能,而且实 ...

  7. java封装性之private

    public class TestDemo{ public static void main(String args[]){ Person perA= new Person(); perA.setNa ...

  8. 兼容ie7、8、9、10、FF、Chrome的遮罩显示

    经常碰到这种情形,要实现图片上有一层遮罩和按钮,鼠标滑过时遮罩颜色变深且按钮图片变化,磕磕碰碰终于弄出来题目所述兼容的解决方案. 对于遮罩的实现,将遮罩层.按钮.图片放置在同一个div中,根据abso ...

  9. NewQuant的设计(二)——MatrixComputation的领域分析

    NewQuant的设计——MatrixComputation的领域分析 MatrixComputation是NewQuant中最重要也是最大的一个模块,这个模块的领域分析要从回答几个问题开始. 一.矩 ...

  10. 怎样用vs 2008 编译C程序

    在大学里都习惯了vc6.0,但是它的集成度并不好,刚试着用vs2008,简单说一下用vs2008编译c的方法吧 首先,在file中新建工程project ,确定之后,会出现新工程(new projec ...