Rolling back transactions 
Author Message
 Rolling back transactions

I am trying to use a technique to rollback changes to a
number of tables.  My objects are structured so that a
data class carries out Fetch/Update/Delete/Insert on a
single table.  Question is, how do I pass a connection
object to the low level objects from my business code
layer.  Pseudo code would look like this..

Dim cnn As ADODB connection
Set cnn = New ADODB connection

cnn.open ODBC Database

cnn.BeginTrans
updatecustomerobject(cnn)
If not successful Then
 cnn.rollback
 exit sub
End If
updateaddressobject(cnn)
If not successful Then
 cnn.rollback
 exit sub
End If
...and so on
cnn.CommitTrans

When I use the conenction object in the object classes I
get an error "The connection cannot be used to perform
this operation. It is either closed or invalid in this
context.".  Why?  Is there a better way to do this (and
keep my data objects intact)? File of example code
attached.

Thanks for your help.

  rollback.txt
4K Download


Sat, 09 Oct 2004 04:37:06 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Roll back transaction Error handling

2. RDO Problem when rolling back transaction - Function sequence error

3. COM+ question: SetAbort not rolling back transaction?

4. MTS, VB and rolling back transactions

5. SetAbort does not roll back transaction

6. Rolling Averages - back to the drawing board

7. committing/rolling back all changes on form

8. Rolling back to vbx's afer upgrading to ocx's

9. Rolling back RDC changes

10. "rolling back" on AddNew

11. Implicit roll back when using server side cursor

12. GetTickCount Rolls Back To Zero?

 

 
Powered by phpBB® Forum Software