Greetings,
I usually write code like this
Try
Me.SaveFields("Save")
'... some code here
Catch
'if an exception is here and the adapter is in a transaction,
'I get an error if I try to rollback the fields ???... why?
If Not adapter.IsTransactionInProgress Then
Me.RollbackFields("Save")
End If
If isRootTransaction Then
adapter.Rollback()
End If
Throw
Finally
If isRootTransaction Then
adapter.CloseConnection()
adapter.Dispose()
End If
End Try
The lines in question are those handling the RollbackFields. Why does this cause an error if the adapter is in the middle of a Transaction but works OK if NOT ??
'if an exception is here and the adapter is in a transaction,
'I get an error if I try to rollback the fields ???... why?
If Not adapter.IsTransactionInProgress Then
Me.RollbackFields("Save")
End If