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
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