PDA

Click to See Complete Forum and Search --> : Database Transactions


Deju
May 3rd, 2000, 04:19 PM
Hi,

I have the following problem

I developed a VB-component (an ActiveX-DLL) that creates a record in SQL-server.

For the interface I'm using ASP.
My ASP-page communicates with my vb-component via properties

So, I'm passing my argument from ASP to VB, let VB create the record. If the creation was successfull, i want to return a value (execution_result) to my ASP.

So far, so good. Everyting works.

But when I want to work with a context

Set mo_context = GetObjectContext()

if creation_Succes then
execution_result = 1
If Not mo_context Is Nothing Then
mo_context.SetComplete
Set mo_context = Nothing
end if
end if

--> if i call, in my asp, the property from execution_result, it is empty. If I remove the line "mo_context.setcomplete" then my execution_result returns 1 to my asp


Thanks

lychew
May 3rd, 2000, 05:03 PM
Are you putting this object in MTS?? GetObjectContext is used when you want to handle transaction in MTS. And is the execution_result a function that will return a value??

Deju
May 3rd, 2000, 05:18 PM
Yes, i'm using MTS.

execution_result is an argument (property) which indicates if the creation was a success or not
When the creation was a success, i put it on 1. If it failed, i put it on 0
Private mi_execution_result As Integer

Public Property Get ai_execution_result() As Integer
ai_execution_result = mi_execution_result
End Property
Public Property Let ai_execution_result(ByVal vData As Integer)
mi_execution_result = vData
End Property

May 4th, 2000, 01:59 AM
if i got the situation correctly your problem is, that MTS requires stateless programming. once your saving routine has finished, the session with your MTS component is terminated too. When you then reference your DLL again, it behaves as if just created. try to return your success-indicator right away from your save-function. hope this helps.

good luck

Deju
May 4th, 2000, 03:07 PM
In my asp-page, I have the following

'Setting my DLL
set datadom = server.createobject("bosoftdev.bo_Software_Dev")

'To call my method
test = datadom.create_record

'When i put a msgbox in my method, the value of my
'execution_result exists


'To get my execution_result in my asp-page

response.write("datadom.ai_execution_result")

'This returns always 0

lychew
May 4th, 2000, 03:19 PM
Shouldn't the response.write like this:

response.write(datadom.ai_execution_result)

Deju
May 4th, 2000, 03:25 PM
Yes,

I'm sorry, it was a mistake of mine.

The reponse.write(ai_execution_result) returns always 0

lychew
May 4th, 2000, 03:37 PM
I can't see what's wrong wtih your program cause i don't really know how you construct your object. But i suggest that you do some error detection and log file writing to your object. Find out actually where is the break point and is there any error. remember to do this:

on error goto Err_Handle
set objContext=GetObjectContext()
.
.
.

WriteLog

if not objContext=nothing then
WriteLog
objContext.setcomplete
end if

end function
Err_Handle:
err.raise err.description
if not objcontext=nothing then
objContext.setabort
end if

And one more thing... make sure your MSDTC service is running. Good Luck.

[Edited by lychew on 05-05-2000 at 04:38 AM]

Deju
May 4th, 2000, 04:02 PM
What about the disc-space on a multi-user platform?

lychew
May 4th, 2000, 04:20 PM
I don't get what you mean.