MTS, VB and rolling back transactions 
Author Message
 MTS, VB and rolling back transactions

I'm testing out  the rollback feature of MTS and MSDTC, and have a VB
component running under MTS, which is trying to roll back a transaction:

***************************************
Function testFunction() as Boolean

        On error goto uh_oh

        Dim objContext As ObjectContext
        Set objContext = GetObjectContext

        sql = "exec server1.dbo.www_updateClientInformation 700, 'hello'"
        myConnection.Execute (sql)
        objContext.SetAbort

        testFunction= True
        Exit Function

    uh_oh:
    debug.print(err.description)
    End  Function
***********************************************************

For whatever reason, the transaction doesn't actually roll back-- the value
"hello" is always placed into the field/record indicated by the stored
procedure above.  I change the value back to something else run the code
again, and "hello" winds up in there again, even after SetAbort has been
run.

I'm using SQL Server 7.0 as the backend, and it has the RPC service running,
along with the DTC service.  My VB component is compiled with the "Supports
Transactions" flag on it.  Am I doing something really wrong here?



Sun, 13 Jul 2003 07:14:42 GMT  
 MTS, VB and rolling back transactions
The component needs to be set to Requires Transaction or Requires New
Transaction.  A component set to Supports Transaction is only transactional
if it is invoked from another component which started a transaction,
otherwise it operates without one.
Hope this helps.


Quote:
> I'm testing out  the rollback feature of MTS and MSDTC, and have a VB
> component running under MTS, which is trying to roll back a transaction:

> ***************************************
> Function testFunction() as Boolean

>         On error goto uh_oh

>         Dim objContext As ObjectContext
>         Set objContext = GetObjectContext

>         sql = "exec server1.dbo.www_updateClientInformation 700, 'hello'"
>         myConnection.Execute (sql)
>         objContext.SetAbort

>         testFunction= True
>         Exit Function

>     uh_oh:
>     debug.print(err.description)
>     End  Function
> ***********************************************************

> For whatever reason, the transaction doesn't actually roll back-- the
value
> "hello" is always placed into the field/record indicated by the stored
> procedure above.  I change the value back to something else run the code
> again, and "hello" winds up in there again, even after SetAbort has been
> run.

> I'm using SQL Server 7.0 as the backend, and it has the RPC service
running,
> along with the DTC service.  My VB component is compiled with the
"Supports
> Transactions" flag on it.  Am I doing something really wrong here?



Sun, 13 Jul 2003 07:54:27 GMT  
 MTS, VB and rolling back transactions
Well what do you know-- it worked!  Thanks a lot for the help.

-Jim



Mon, 14 Jul 2003 04:33:50 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Roll back transaction Error handling

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

3. Rolling back transactions

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

5. SetAbort does not roll back transaction

6. MTS / DTC not rollling back transaction

7. MTS / DTC not rollling back transaction

8. MTS / DTC not rollling back transaction

9. When to use MTS transactions and ADO Transactions

10. How to use MTS Style Transactions in VB.Net

11. VB MTS Component, ADO, and "Transactions"

12. VB and mts transactions - please help

 

 
Powered by phpBB® Forum Software