BobRoyAce
2011-12-29 08:55:47 UTC
I have an application that performs a series of DB actions, using
OLEDB to SQL Server. I use code as shown below to create a DB
connection, and transaction. When the code that attempts to Commit the
transaction (i.e. m_cnnTransaction.Commit()) executes, I get an error
message that says "The transaction operation cannot be performed
because there are pending requests working on this transaction". I
can't figure out why this is happening to cause this. This has worked
for months, and recently "broke." I must have changed something, but
can't find what was changed that could cause this (using Visual
Sourcesafe).
Any ideas as to what could be causing this?
--- CODE BEGINS ---
m_cnn = New
SqlClient.SqlConnection(My.Settings.GrpDBConnectionString)
m_cnn.Open()
m_cnnTransaction = m_cnn.BeginTransaction()
Try
MerchantProcessorsControl1.PostData(m_cnn, m_cnnTransaction)
_CurrentApp.PostData(m_cnn, m_cnnTransaction)
m_cnnTransaction.Commit()
Return eRecordSavedResult.RecordSaved
Catch ex As Exception
ShowWarningMessage("Error occurred trying to save Application
data." & vbCrLf & ex.Message & vbCrLf & ex.StackTrace)
m_cnnTransaction.Rollback()
Return eRecordSavedResult.RecordNotSaved
Finally
m_cnn = Nothing
m_cnnTransaction = Nothing
End Try
--- CODE ENDS ---
OLEDB to SQL Server. I use code as shown below to create a DB
connection, and transaction. When the code that attempts to Commit the
transaction (i.e. m_cnnTransaction.Commit()) executes, I get an error
message that says "The transaction operation cannot be performed
because there are pending requests working on this transaction". I
can't figure out why this is happening to cause this. This has worked
for months, and recently "broke." I must have changed something, but
can't find what was changed that could cause this (using Visual
Sourcesafe).
Any ideas as to what could be causing this?
--- CODE BEGINS ---
m_cnn = New
SqlClient.SqlConnection(My.Settings.GrpDBConnectionString)
m_cnn.Open()
m_cnnTransaction = m_cnn.BeginTransaction()
Try
MerchantProcessorsControl1.PostData(m_cnn, m_cnnTransaction)
_CurrentApp.PostData(m_cnn, m_cnnTransaction)
m_cnnTransaction.Commit()
Return eRecordSavedResult.RecordSaved
Catch ex As Exception
ShowWarningMessage("Error occurred trying to save Application
data." & vbCrLf & ex.Message & vbCrLf & ex.StackTrace)
m_cnnTransaction.Rollback()
Return eRecordSavedResult.RecordNotSaved
Finally
m_cnn = Nothing
m_cnnTransaction = Nothing
End Try
--- CODE ENDS ---