Nested transactions with SQL connection object - how?

  • Thread starter Thread starter Julia B
  • Start date Start date
J

Julia B

Hi all

I'm really struggling here to work out how to do nested transactions with my
asp.net 2.0 web application, connected to a sql server database.

If I try to begin a second transaction on my transaction object I get the
error "SQL connection does not support parallel transactions".

Private _MyTrans As SqlTransaction
Public transCount As Integer

Public Sub startTransaction()
If _MyTrans Is Nothing Then
_MyTrans = conn.BeginTransaction
transCount = 1
Else
'this is where I get the error when the second transaction is
called
_MyTrans.Connection.BeginTransaction()
transCount += 1
End If
End Sub

I've googled and looked on help, but can't find any solution.

Is it possible, are there any examples anywhere?

PS. I know I can do nested transactions in stored procedures but I don't
want to do this because of the number of stored procedures I'll end up having
to generate.

Thanks

Julia
 
Back
Top