// 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. PHP乱码问题,UTF-8(乱码) (share)

    一.PHP页面转UTF-8编码问题 1.在代码开始出加入一行: header("Content-Type: text/html;charset=utf-8"); 2.PHP文件编码 ...

  2. JavaScript面向对象,及面向对象的特点,和如何构造函数

    1.面向对象和面向过程的区别 面向过程就是分析出解决问题所需要的步骤,然后用函数把这些步骤一步一步实现,使用的时候一个一个依次调用就可以了: 面向对象是把构成问题事务分解成各个对象,建立对象的目的不是 ...

  3. echo '<script>alert("插入成功")</script>';

    echo '<script>alert("插入成功")</script>'; <?php if ( ! defined('BASEPATH')) ex ...

  4. OS实验报告——作业调度模拟程序

    一.目的和要求 1. 实验目的 (1)加深对作业调度算法的理解: (2)进行程序设计的训练. 2.实验要求 用高级语言编写一个或多个作业调度的模拟程序. 单道批处理系统的作业调度程序.作业一投入运行, ...

  5. the difference between const int *, int * const, int const *

    Some people may be confused about the sequence of const and * on declaration in C++/C, me too. Now I ...

  6. 流编辑器-sed

    sed 参数: 1.'s' 替换 sed 's/search-word/replace-word/' file-name 替换file-name文件中的search-word为replace-word ...

  7. how to build apache log4cxx 0.10 by Visual Studio 201*

    Chapter 1 Official Steps  We are going to follow the steps here, http://logging.apache.org/log4cxx/b ...

  8. mongodb 对内嵌文档(数组) group分页查询,并设置查询条件

    文档示例Account的其中一条记录: // collection: Account { "_id" : ObjectId("5843e38e535f3708f759b2 ...

  9. Zookeeper启动过程

    在上一篇,我们了解了zookeeper最基本的配置,也从中了解一些配置的作用,那么这篇文章中,我们将介绍Zookeeper的启动过程,我们在了解启动过程的时候还要回过头看看上一篇中各个配置参数在启动时 ...

  10. [转]面向过程的分析(POA),和面向对象的分析(OOA)

    欢迎转载本文,转载地址: http://www.juliantec.info/articles/basic-concept/poa-and-ooa.html 软件开发方法论概述 在60年代的软件开发行 ...