// 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. html+css基础知识总结

    1.HTML书写的基本规范      img标签必须得写alt=""      标签名和属性名字必须小写      引号必须用双引号      双标签必须有闭合标签      单标 ...

  2. Spring JdbcTemplate方法详解

    JdbcTemplate主要提供以下五类方法: execute方法:可以用于执行任何SQL语句,一般用于执行DDL语句: update方法及batchUpdate方法:update方法用于执行新增.修 ...

  3. maven web 项目中启动报错java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener

    环境:Groovy/Grails Tool Suite 3.1.0.RELEASE(BASED ON ECLIPSE JUNO 3.8.1).JDK1.6.Maven3.05.Tomcat6 错误描述 ...

  4. jquery实现AJAX的4种方法

    当我们用javascript写ajax程序写得很“开心”的时候,突然有人告诉你有一种东西叫jquery,它会告诉你不直接和 HttpRequest是多么的快乐,同时你再也不需要再烦恼纠结的ajax乱码 ...

  5. codeforces 733D

    明白了自己这么菜的原因多半是赛后不肯去补那些需要多花点时间思考的题目以及效率不高,但愿现在还不算晚... #include<bits/stdc++.h> #include<iostr ...

  6. tomcat7 Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The configuration may be corrupt or incomplete

    参考连接: http://lucasterdev.altervista.org/wordpress/2012/05/12/could-not-load-the-tomcat-server-config ...

  7. JS中正则匹配的三个方法match exec test的用法

    javascript中正则匹配有3个方法,match,exec,test: match是字符串的一个方法,接收一个RegExp对象做为参数: match() 方法可在字符串内检索指定的值,或找到一个或 ...

  8. 新手之自动转存DLL——20150626星期五

    -------------------菜鸟错例一:--------------------------------------------- int a=0; if() { int a = GetTy ...

  9. 解释器模式(Interpreter Pattern)

    定义:给定一种语言,定义他的文法的一种表示,并定义一个解释器,该解释器使用该表示来解释语言中句子. 抽象解释器:声明一个所有具体表达式都要实现的抽象接口(或者抽象类),接口中主要是一个interpre ...

  10. linux 下如何抓取HTTP流量包(httpry)

    基于某些原因你需要嗅探HTTP Web流量(即HTTP请求和响应).例如,你可能会测试Web服务器的性能,或者x奥uy调试Web应用程序或RESTful服务 ,又或者试图解决PAC(代理自动配置)问题 ...