为什么SqlTransaction.Rollback会抛出SqlException(11,-2)(即SQL超时异常)
// 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超时异常)的更多相关文章
- 页面打开 抛出w3wp.exe 中发生未处理异常
页面打开 抛出w3wp.exe 中发生未处理异常
- HttpClient连接池抛出大量ConnectionPoolTimeoutException: Timeout waiting for connection异常排查
转自: http://blog.csdn.net/shootyou/article/details/6615051 今天解决了一个HttpClient的异常,汗啊,一个HttpClient使用稍有不慎 ...
- 1:MUI选择器组件抛出“n.getSelectedItem is not a function”异常的解决办法 2:mui三级联动 3:移动端关闭虚拟键盘
1:如下图 问题:引用了mui的地址选择的三级联动的应用在h5上的组件 百度发现别人思路对 Array 原型链方法扩充时,会抛出这个异常. 修改方法: mui.poppicker.js 第 112 行 ...
- pytest执行用例时从conftest.py抛出ModuleNotFoundError:No module named 'XXX'异常的解决办法
一.问题描述 在项目根目录下执行整个测试用例,直接从conftest.py模块中抛出了ModuleNotFoundError:No module named 'TestDatas'的异常: 二.解决方 ...
- 从constructor中抛出exception后,constructor会返回null吗?
刚才琢磨这个问题主要是在想,如果constructor抛出了exception,那么返回的object是什么一个情况呢?如果我这个object中有一些关键的资源没有初始化,比如说Database co ...
- Java中,异常的处理及抛出
首先我们需要知道什么是异常? 常通常指,你的代码可能在编译时没有错误,可是运行时会出现异常.比如常见的空指针异常.也可能是程序可能出现无法预料的异常,比如你要从一个文件读信息,可这个文件不存在,程序无 ...
- PLSQL_Oracle Exception异常分类、异常抛出、异常处理、异常传播(概念)
2014-06-03 Created By BaoXinjian
- java——异常类、异常捕获、finally、异常抛出、自定义异常
编译错误:由于编写程序不符合程序的语法规定而导致的语法问题. 运行错误:能够顺利的编译通过,但是在程序运行过程中产生的错误. java异常类都是由Throwable类派生而来的,派生出来的两个分支分别 ...
- java的异常抛出throws和throw的简单使用
前提: 当在程序测试时,如果你需要定义一个自己的异常,而非现在已经存在的异常,这个时候你需要用到throws和throw,try-catch只是一个简单的捕获异常的过程. 代码如下: package ...
随机推荐
- Python 爬虫 字符集乱码问题
解决办法: http://worldant.blog.sohu.com/251745784.html 爬虫爬下来的源代码和网页的源代码不一样,可以先把爬下来的代码输出或保存在文件中,然后再写正则匹配表 ...
- js jquery实时计算输入字符
在项目中需要倒还可以输入多少字符
- java连接sql server2005
转自:http://blog.sina.com.cn/s/blog_889b58310100zqyz.html 一:配置 第一步:在网上下载SQLServer2005的驱动包 http://www.m ...
- tornado中self.write() 写list
tornado源码中不支持在self.write()中直接传入list对象,源代码如下 def write(self, chunk): if self._finished: raise Runtime ...
- JAVA,NET RSA密钥格式转换
JAVA和NET RSA密钥格式相互转换(公钥,私钥) 做了一个小项目遇到java和.net非对称加密问题,java的公钥和私钥就直接是一个字符串的形式展示的,但是.net是以xml简单包裹形式展示的 ...
- 用JavaScript输出表格
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- [非原创]Project facet Java version 1.8 is not supported解决记录
原博地址:http://blog.csdn.net/dingchenxixi/article/details/51496998 一看知道是因为jdk版本不一致所导致,如何解决? 方法一: 选中项目 P ...
- 小制作-css+html旋转木马
源代码: <!DOCTYPE html><html><head> <title></title> <meta charse ...
- NOIP2014提高组解方程
其实没有太难 但是不知道的话想不到 考场上大概有50分吧 #include <iostream> #include <stdio.h> #include <queue&g ...
- css基础知识点
回顾 1.结构标记 <header></header> <nav></nav> <section></section> < ...