How to incorporate MTS in VB EXE?

ohjani
08-22-2000, 06:06 AM
i have a class called Class1 from "Testing.DLL" written like :

Sub Test (Byval myVar)
Dim ctxObj as ObjectContext

Set ctxObj = GetObjectContext ()
If <myVar condition = True> Then
'update database
ctxObj.SetComplete
Else
'don't update database
ctxObj.SetAbort
End If
End Sub

Now in the EXE project i have a sub which i have included the Testing.DLL in
the project reference :

Sub btn1_Click ()
Dim myObj as New Testing.Class1

myObj.Test strA 'This is a correct input
myObj.Test strB 'This is a wrong input which will cause the MTS to
call SetAbort in the DLL

End Sub

Now my question is, how do i make the btn_Click involved in the MTS
transaction? With the code above, it doesn't actually Abort the whole
transaction eventhough the 2nd line has caused an error.
strA condition still updated the database, while only strB is cancelled.
How do i make it so that if one of them failed, all will failed?

It was running fine in ASP cos i've included <%Transaction = Required> in
the page, but i don't know how to do it in VB application.


ohjani

niktesla
08-22-2000, 08:52 PM

ohjani
08-23-2000, 04:49 AM
i've set the necessary properties in the DLL, and actually the DLL is currenly running fine in an ASP page.

But now i need to reuse the component in an EXE application and i have no idea how to start it cos i can't do <%Transaction = Required> in EXE as what i've done in ASP.


chung

Moshky
08-30-2000, 06:58 PM
In the properties of the class in the DLL you can set the transaction mode (MTSTransactionMode).

Lār***

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum