
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." 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. 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. 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>
ByVal strInfo As Variant, ByRef vResult As Variant) As Boolean</FONT>
<BR><FONT SIZE=-1> Dim rdoEnv1 As rdoEnvironment</FONT>
<BR><FONT SIZE=-1> Dim rdoCon1 As rdoConnection</FONT>
<BR><FONT SIZE=-1> Dim sql_$</FONT>
<BR><FONT SIZE=-1> Dim ctxObject As ObjectContext</FONT>
<BR><FONT SIZE=-1> Set ctxObject = GetObjectContext()</FONT>
<BR><FONT SIZE=-1> </FONT>
<BR><FONT SIZE=-1> On Error GoTo ErrorHandler</FONT>
<BR><FONT SIZE=-1> </FONT>
<BR><FONT SIZE=-1> If GetDBConnection(rdoEnv1, rdoCon1)
Then</FONT>
<BR><FONT SIZE=-1> sql_$ = "INSERT
INTO tbs_info ( tbs_name, tbs_data ) "</FONT>
<BR><FONT SIZE=-1> sql_$ = sql_$
& "VALUES ( '" & strName & "', '" & strInfo & "' )"</FONT>
<BR><FONT SIZE=-1> </FONT>
<BR><FONT SIZE=-1> rdoCon1.Execute
sql_$</FONT>
<BR><FONT SIZE=-1> </FONT>
<BR><FONT SIZE=-1> PrintLog "EXECUTED:"
& sql_$, strLogFile</FONT>
<BR><FONT SIZE=-1> </FONT>
<BR><FONT SIZE=-1> ctxObject.SetComplete
'<============================= the "gotcha"</FONT>
<BR><FONT SIZE=-1> Beep</FONT>
<BR><FONT SIZE=-1> PrintLog "ctxObject.SetComplete",
strLogFile</FONT>
<BR><FONT SIZE=-1> </FONT>
<BR><FONT SIZE=-1> AddTBInfo
= True</FONT>
<BR><FONT SIZE=-1> vResult =
"Success!!!"</FONT>
<BR><FONT SIZE=-1> Else</FONT>
<BR><FONT SIZE=-1> vResult =
ERR_CONN_DB</FONT>
<BR><FONT SIZE=-1> AddTBInfo
= False</FONT>
<BR><FONT SIZE=-1> ctxObject.SetAbort</FONT>
<BR><FONT SIZE=-1> End If</FONT><FONT SIZE=-1></FONT>
<P><FONT SIZE=-1>Function_Exit:</FONT>
<BR><FONT SIZE=-1> On Error Resume Next</FONT>
<BR><FONT SIZE=-1> If Not rdoCon1 Is Nothing Then</FONT>
<BR><FONT SIZE=-1> rdoCon1.Close</FONT>
<BR><FONT SIZE=-1> Set rdoCon1
= Nothing</FONT>
<BR><FONT SIZE=-1> End If</FONT>
<BR><FONT SIZE=-1> If Not rdoEnv1 Is Nothing Then</FONT>
<BR><FONT SIZE=-1> Set rdoEnv1
= Nothing</FONT>
<BR><FONT SIZE=-1> End If</FONT>
<BR><FONT SIZE=-1> Exit Function</FONT><FONT SIZE=-1></FONT>
<P><FONT SIZE=-1>ErrorHandler:</FONT>
<BR><FONT SIZE=-1> Select Case (Err)</FONT>
<BR><FONT SIZE=-1> Case 0:</FONT>
<BR><FONT SIZE=-1> Case Else:</FONT>
<BR><FONT SIZE=-1>
vResult = Err.Description ' return the error message</FONT>
<BR><FONT SIZE=-1>
ctxObject.SetAbort</FONT>
<BR><FONT SIZE=-1>
PrintLog "Error Handler:" & vResult, strLogFile</FONT>
<BR><FONT SIZE=-1>
AddTBInfo = False
' indicate that an error occured</FONT>
<BR><FONT SIZE=-1>
GoTo Function_Exit</FONT>
<BR><FONT SIZE=-1> 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> ACTIVEX DLL</FONT>
<BR><FONT SIZE=-1> UNATTENDED EXECUTION/UPGRADE CONTROLS ARE CHECKED</FONT>
<BR><FONT SIZE=-1> SINGLE THREADED</FONT>
<BR><FONT SIZE=-1> COMPILE TO NATIVE CODE, COMPILE FOR FAST CODE OPTIONS</FONT>
<BR><FONT SIZE=-1> REMOTE SERVER FILES CREATED</FONT>
<BR><FONT SIZE=-1> 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> ...basic VBA, OLE AUTOMATION, RDO REFERENCES</FONT>
<BR><FONT SIZE=-1> MICROSOFT TRANSACTION SERVER 1.0 TYPE LIBRARY</FONT>
<BR><FONT SIZE=-1> SHARED PROPERTY MANAGER 1.0 TYPE LIBRARY</FONT>
<BR><FONT SIZE=-1></FONT> </HTML>
--------------249C287955C08E61C85B3DDA--