我有一吨重的是一直在这里几个月,而今天工作的代码,我看到了下面的异常记录:什么时候发生“SqlConnection不支持并行事务”?
System.InvalidOperationException
SqlConnection does not support parallel transactions.
at System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(
IsolationLevel iso, String transactionName)
at System.Data.SqlClient.SqlConnection.BeginTransaction(
IsolationLevel iso, String transactionName)
at my code here
,我想探讨为什么这个异常被抛出。我已阅读BeginTransaction()
的MSDN描述,并且它说的很好,有时可能会引发此异常。
这个例外意味着什么?我应该寻找的代码有哪些缺陷?
您是否使用普通的SqlConnection/SqlCommmand/SqlDataAdapter或者您使用的是ORM(例如EF或L2S或其他)?并且是使用显式事务或TransactionScopes的代码?另外,您是否可以在记录/抛出异常的错误周围发布代码示例? – SimonGoldstone
检查这个答案:http://stackoverflow.com/questions/407320/strange-sql2005-problem-sqlconnection-does-not-support-parallel-transactions 这是关于同样的问题。 – LawfulHacker
@SimonGoldstone:如果我能缩小问题范围,我不会问这个问题。我并不是问“我的代码无法正常工作,请尽快帮忙”,我问我需要在代码中寻找什么。 – sharptooth