Results 1 to 10 of 10

Thread: Database Transactions

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    belgium
    Posts
    74

    Question

    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

  2. #2
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    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??

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    belgium
    Posts
    74
    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


  4. #4
    Guest
    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

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    belgium
    Posts
    74
    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

  6. #6
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    Shouldn't the response.write like this:

    response.write(datadom.ai_execution_result)


  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    belgium
    Posts
    74
    Yes,

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

    The reponse.write(ai_execution_result) returns always 0

  8. #8
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    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]

  9. #9

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    belgium
    Posts
    74
    What about the disc-space on a multi-user platform?

  10. #10
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    I don't get what you mean.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width