Transaction Server; question concerning 
Author Message
 Transaction Server; question concerning

--------------249C287955C08E61C85B3DDA
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Anyone familiar with MTS development has probably jumped this hurdle,
however, I'm
still on the "other side."  According to all I've read, the syntax of
the following
function should work, but it's getting the "Object Variable or With
Block Variable
Not Set" error message when hitting the .SetComplete line.  The
preceeding code is
executing correctly, in essense, the RDO Execute statement is updating
the SQL data-
base, but I'm wondering why.  I wouldn't think that the transaction
would be valid
if the ctxObject is an invalid reference...

I'm not sure if this is a version 1.0 "thang" or not, I do have the IIS
2.0 Beta
ordered, but I suspect there's more than meets the eye with this
inconsistancy.

If you care to respond, please email me at ix.netcom.com, my account is
jfbailey

'===============================================
' OFFENDING FUNCTION CALL
'===============================================

Public Function AddTBInfo(ByVal strName As Variant, _
                                ByVal strInfo As Variant, ByRef vResult
As Variant) As Boolean
    Dim rdoEnv1 As rdoEnvironment
    Dim rdoCon1 As rdoConnection
    Dim sql_$
    Dim ctxObject As ObjectContext
    Set ctxObject = GetObjectContext()

    On Error GoTo ErrorHandler

    If GetDBConnection(rdoEnv1, rdoCon1) Then
        sql_$ = "INSERT INTO tbs_info ( tbs_name, tbs_data ) "
        sql_$ = sql_$ & "VALUES ( '" & strName & "', '" & strInfo & "'
)"

        rdoCon1.Execute sql_$

        PrintLog "EXECUTED:" & sql_$, strLogFile

        ctxObject.SetComplete '<============================= the
"gotcha"
        Beep
        PrintLog "ctxObject.SetComplete", strLogFile

        AddTBInfo = True
        vResult = "Success!!!"
    Else
        vResult = ERR_CONN_DB
        AddTBInfo = False
        ctxObject.SetAbort
    End If

Function_Exit:
    On Error Resume Next
    If Not rdoCon1 Is Nothing Then
        rdoCon1.Close
        Set rdoCon1 = Nothing
    End If
    If Not rdoEnv1 Is Nothing Then
        Set rdoEnv1 = Nothing
    End If
    Exit Function

ErrorHandler:
    Select Case (Err)
        Case 0:
        Case Else:
            vResult = Err.Description     ' return the error message
            ctxObject.SetAbort
            PrintLog "Error Handler:" & vResult, strLogFile
            AddTBInfo = False                 ' indicate that an error
occured
            GoTo Function_Exit
    End Select
End Function

'===============================================
' PROJECT PROPERTIES
'===============================================
 ACTIVEX DLL
 UNATTENDED EXECUTION/UPGRADE CONTROLS ARE CHECKED
 SINGLE THREADED
 COMPILE TO NATIVE CODE, COMPILE FOR FAST CODE OPTIONS
 REMOTE SERVER FILES CREATED
 NO VERSION COMPATIBILITY

'===============================================
' PROJECT REFERENCES
'===============================================
 ...basic VBA, OLE AUTOMATION, RDO REFERENCES
 MICROSOFT TRANSACTION SERVER 1.0 TYPE LIBRARY
 SHARED PROPERTY MANAGER 1.0 TYPE LIBRARY

--------------249C287955C08E61C85B3DDA
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
<FONT SIZE=-1>Anyone familiar with MTS development has probably jumped
this hurdle, however, I'm</FONT>
<BR><FONT SIZE=-1>still on the "other side."&nbsp; According to all I've
read, the syntax of the following</FONT>
<BR><FONT SIZE=-1>function should work, but it's getting the "Object Variable
or With Block Variable</FONT>
<BR><FONT SIZE=-1>Not Set" error message when hitting the .SetComplete
line.&nbsp; The preceeding code is</FONT>
<BR><FONT SIZE=-1>executing correctly, in essense, the RDO Execute statement
is updating the SQL data-</FONT>
<BR><FONT SIZE=-1>base, but I'm wondering why.&nbsp; I wouldn't think that
the transaction would be valid</FONT>
<BR><FONT SIZE=-1>if the ctxObject is an invalid reference...</FONT><FONT SIZE=-1></FONT>

<P><FONT SIZE=-1>I'm not sure if this is a version 1.0 "thang" or not,
I do have the IIS 2.0 Beta</FONT>
<BR><FONT SIZE=-1>ordered, but I suspect there's more than meets the eye
with this inconsistancy.</FONT><FONT SIZE=-1></FONT>

<P><FONT SIZE=-1>If you care to respond, please email me at ix.netcom.com,
my account is jfbailey</FONT><FONT SIZE=-1></FONT>

<P><FONT SIZE=-1>'===============================================</FONT>
<BR><FONT SIZE=-1>' OFFENDING FUNCTION CALL</FONT>
<BR><FONT SIZE=-1>'===============================================</FONT><FONT SIZE=-1></FONT>

<P><FONT SIZE=-1>Public Function AddTBInfo(ByVal strName As Variant, _</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ByVal strInfo As Variant, ByRef vResult As Variant) As Boolean</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; Dim rdoEnv1 As rdoEnvironment</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; Dim rdoCon1 As rdoConnection</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; Dim sql_$</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; Dim ctxObject As ObjectContext</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; Set ctxObject = GetObjectContext()</FONT>
<BR><FONT SIZE=-1>&nbsp;</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; On Error GoTo ErrorHandler</FONT>
<BR><FONT SIZE=-1>&nbsp;</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; If GetDBConnection(rdoEnv1, rdoCon1)
Then</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sql_$ = "INSERT
INTO tbs_info ( tbs_name, tbs_data ) "</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sql_$ = sql_$
&amp; "VALUES ( '" &amp; strName &amp; "', '" &amp; strInfo &amp; "' )"</FONT>
<BR><FONT SIZE=-1>&nbsp;</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rdoCon1.Execute
sql_$</FONT>
<BR><FONT SIZE=-1>&nbsp;</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PrintLog "EXECUTED:"
&amp; sql_$, strLogFile</FONT>
<BR><FONT SIZE=-1>&nbsp;</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ctxObject.SetComplete
'&lt;============================= the "gotcha"</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Beep</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PrintLog "ctxObject.SetComplete",
strLogFile</FONT>
<BR><FONT SIZE=-1>&nbsp;</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddTBInfo
= True</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vResult =
"Success!!!"</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; Else</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vResult =
ERR_CONN_DB</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddTBInfo
= False</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ctxObject.SetAbort</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; End If</FONT><FONT SIZE=-1></FONT>

<P><FONT SIZE=-1>Function_Exit:</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; On Error Resume Next</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; If Not rdoCon1 Is Nothing Then</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rdoCon1.Close</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set rdoCon1
= Nothing</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; End If</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; If Not rdoEnv1 Is Nothing Then</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set rdoEnv1
= Nothing</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; End If</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; Exit Function</FONT><FONT SIZE=-1></FONT>

<P><FONT SIZE=-1>ErrorHandler:</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; Select Case (Err)</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case 0:</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case Else:</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
vResult = Err.Description&nbsp;&nbsp;&nbsp;&nbsp; ' return the error message</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ctxObject.SetAbort</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PrintLog "Error Handler:" &amp; vResult, strLogFile</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
AddTBInfo = False&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
' indicate that an error occured</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
GoTo Function_Exit</FONT>
<BR><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; End Select</FONT>
<BR><FONT SIZE=-1>End Function</FONT><FONT SIZE=-1></FONT>

<P><FONT SIZE=-1>'===============================================</FONT>
<BR><FONT SIZE=-1>' PROJECT PROPERTIES</FONT>
<BR><FONT SIZE=-1>'===============================================</FONT>
<BR><FONT SIZE=-1>&nbsp;ACTIVEX DLL</FONT>
<BR><FONT SIZE=-1>&nbsp;UNATTENDED EXECUTION/UPGRADE CONTROLS ARE CHECKED</FONT>
<BR><FONT SIZE=-1>&nbsp;SINGLE THREADED</FONT>
<BR><FONT SIZE=-1>&nbsp;COMPILE TO NATIVE CODE, COMPILE FOR FAST CODE OPTIONS</FONT>
<BR><FONT SIZE=-1>&nbsp;REMOTE SERVER FILES CREATED</FONT>
<BR><FONT SIZE=-1>&nbsp;NO VERSION COMPATIBILITY</FONT><FONT SIZE=-1></FONT>

<P><FONT SIZE=-1>'===============================================</FONT>
<BR><FONT SIZE=-1>' PROJECT REFERENCES</FONT>
<BR><FONT SIZE=-1>'===============================================</FONT>
<BR><FONT SIZE=-1>&nbsp;...basic VBA, OLE AUTOMATION, RDO REFERENCES</FONT>
<BR><FONT SIZE=-1>&nbsp;MICROSOFT TRANSACTION SERVER 1.0 TYPE LIBRARY</FONT>
<BR><FONT SIZE=-1>&nbsp;SHARED PROPERTY MANAGER 1.0 TYPE LIBRARY</FONT>
<BR><FONT SIZE=-1></FONT>&nbsp;</HTML>

--------------249C287955C08E61C85B3DDA--



Wed, 12 Apr 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Why to use COM+ transaction and not just SQL Server transaction

2. Why to use COM+ transaction and not just SQL Server transaction

3. Begin Transaction sets opened recordset in zombie state (alternative question: client and server side cursors)

4. To Transaction or Not to Transaction that is the question

5. No Microsoft Transaction Server Type Library in Windows 2000 Advanced Server

6. Creating Server based transaction servers

7. Creating Server based transaction servers

8. Dozy question concerning arrays

9. newbie question concerning if-then-else

10. DAO Question Concerning a Word Mail Merge from Access

11. ProjectResourceAdd concern/question

12. API Question Concerning Shell/Exec VB5.0

 

 
Powered by phpBB® Forum Software