pipe
asked on
MTS/COM
hello-
im trying to debug my business layer object from vb 6.
when i call "GetObjectContext" it comes back as nothing.
can i debug this from vb or does it need to be run thru mts to get the object context?
thanks - p
Public Function UpdateLinkCategories(ByVal vnLinkID As Variant, _
vsCategories As Variant) As Variant
On Error GoTo err
'' Consts
Const METHOD = " BXeroxLinkAdmin.UpdateLink Categories "
Dim mobjContext As ObjectContext
Dim mobjDXeroxLinkAdmin As DXeroxLinkAdmin.CXeroxLink Admin
Dim mvCategories As Variant
Dim i As Integer
Set mobjContext = GetObjectContext()
Set mobjDXeroxLinkAdmin = mobjContext.CreateInstance ("DXeroxLi nkAdmin.CX eroxLinkAd min")
Set mobjDXeroxLinkAdmin = New DXeroxLinkAdmin.CXeroxLink Admin
'' Delete all the categories for this link. We will reenter all of the
'' categories below.
mobjDXeroxLinkAdmin.DelLin kCategorie s (vnLinkID)
'' Split up the categories
mvCategories = Split(Trim(vsCategories), ",")
'' Insert all the categories in the junction table
For i = 0 To UBound(mvCategories)
Call mobjDXeroxLinkAdmin.Insert SelCategor y(vnLinkID , mvCategories(i))
Next i
Set mobjDXeroxLinkAdmin = Nothing
mobjContext.SetComplete
Exit Function
err:
mobjContext.SetAbort
Set mobjDXeroxLinkAdmin = Nothing
err.Raise err.Number, err.Source, METHOD & err.Description
End Function
im trying to debug my business layer object from vb 6.
when i call "GetObjectContext" it comes back as nothing.
can i debug this from vb or does it need to be run thru mts to get the object context?
thanks - p
Public Function UpdateLinkCategories(ByVal
vsCategories As Variant) As Variant
On Error GoTo err
'' Consts
Const METHOD = " BXeroxLinkAdmin.UpdateLink
Dim mobjContext As ObjectContext
Dim mobjDXeroxLinkAdmin As DXeroxLinkAdmin.CXeroxLink
Dim mvCategories As Variant
Dim i As Integer
Set mobjContext = GetObjectContext()
Set mobjDXeroxLinkAdmin = mobjContext.CreateInstance
Set mobjDXeroxLinkAdmin = New DXeroxLinkAdmin.CXeroxLink
'' Delete all the categories for this link. We will reenter all of the
'' categories below.
mobjDXeroxLinkAdmin.DelLin
'' Split up the categories
mvCategories = Split(Trim(vsCategories), ",")
'' Insert all the categories in the junction table
For i = 0 To UBound(mvCategories)
Call mobjDXeroxLinkAdmin.Insert
Next i
Set mobjDXeroxLinkAdmin = Nothing
mobjContext.SetComplete
Exit Function
err:
mobjContext.SetAbort
Set mobjDXeroxLinkAdmin = Nothing
err.Raise err.Number, err.Source, METHOD & err.Description
End Function
It needs to be run through MTS to get the context. I'm not sure if there is a way to make it use MTS when you run it from the development environment. But when you are running the program in development it doesn't use MTS.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, im running w2k sp2. im a little confused on what i need to do.
Listening...
i had the same problem and it was some info on istalling sp 2 and do someting else, since i can't install sp2 i did not record q number. you can search support.mircosoft.com
i am using the following ....
Public Function IsIDE() As Boolean
On Error Resume Next
IsIDE = True
Exit Function
Debug.Assert 1 / 0
Select Case Err.Number
Case 0
IsIDE = False
Case Else
IsIDE = True
End Select
End Function
Public Function Frcs(ByVal lvsLoadDate As String, _
ByVal lvsFilter As String) As ADODB.Recordset
Dim lvsSQL As String
Dim ljrsData As ADODB.Recordset
On Error GoTo Error_
lvsLoadDate = ConvertDate(lvsLoadDate)
lvsSQL = " SELECT CP_FORC_COST_MANUAL_COMMEN TS.PART_NU MBER AS PART" & _
" FROM " & gcsOwner & "CP_PARTS, " & _
gcsOwner & "CP_FORC_COST_MANUAL_COMME NTS " & _
" WHERE (CP_PARTS.PART_NUMBER = CP_FORC_COST_MANUAL_COMMEN TS.PART_NU MBER " & _
" AND CP_PARTS.LOAD_DATE = CP_FORC_COST_MANUAL_COMMEN TS.LOAD_DA TE) " & _
" AND CP_FORC_COST_MANUAL_COMMEN TS.LOAD_DA TE = " & ConvertToDbDate(lvsLoadDat e) & _
lvsFilter
Set ljrsData = New ADODB.Recordset
Call utOpenConnection
With ljrsData
.CursorLocation = adUseClient
.Open lvsSQL, mjcnMain, adOpenStatic, adLockReadOnly
Set .ActiveConnection = Nothing
End With
Set Frcs = ljrsData
Call utCloseConnection
If IsIDE = False Then
GetObjectContext.SetComple te
End If
Exit_:
Exit Function
Error_:
Dim luError As guError
luError = ErrorToUDT
Call utCloseConnection(True)
If IsIDE = False Then
GetObjectContext.SetAbort
End If
ForwardError luError, utErrorSource("Frcs ")
End Function
i am using the following ....
Public Function IsIDE() As Boolean
On Error Resume Next
IsIDE = True
Exit Function
Debug.Assert 1 / 0
Select Case Err.Number
Case 0
IsIDE = False
Case Else
IsIDE = True
End Select
End Function
Public Function Frcs(ByVal lvsLoadDate As String, _
ByVal lvsFilter As String) As ADODB.Recordset
Dim lvsSQL As String
Dim ljrsData As ADODB.Recordset
On Error GoTo Error_
lvsLoadDate = ConvertDate(lvsLoadDate)
lvsSQL = " SELECT CP_FORC_COST_MANUAL_COMMEN
" FROM " & gcsOwner & "CP_PARTS, " & _
gcsOwner & "CP_FORC_COST_MANUAL_COMME
" WHERE (CP_PARTS.PART_NUMBER = CP_FORC_COST_MANUAL_COMMEN
" AND CP_PARTS.LOAD_DATE = CP_FORC_COST_MANUAL_COMMEN
" AND CP_FORC_COST_MANUAL_COMMEN
lvsFilter
Set ljrsData = New ADODB.Recordset
Call utOpenConnection
With ljrsData
.CursorLocation = adUseClient
.Open lvsSQL, mjcnMain, adOpenStatic, adLockReadOnly
Set .ActiveConnection = Nothing
End With
Set Frcs = ljrsData
Call utCloseConnection
If IsIDE = False Then
GetObjectContext.SetComple
End If
Exit_:
Exit Function
Error_:
Dim luError As guError
luError = ErrorToUDT
Call utCloseConnection(True)
If IsIDE = False Then
GetObjectContext.SetAbort
End If
ForwardError luError, utErrorSource("Frcs ")
End Function
or if i need to create an object :
If IsIDE = False Then
Set ljBus = GetObjectContext.CreateIns
Else
Set ljBus = New Frcst_B.CMainSrch
End If
you dont need to do anything, provided you set your class to something like 'No Transactions'. VB will then run your component in MTS/COM+ on the fly.
Make sure your class Implements ObjectControl too. i wouldnt hold the objectcontext in class scope - just use it as you need to within each method call.
Make sure your class Implements ObjectControl too. i wouldnt hold the objectcontext in class scope - just use it as you need to within each method call.
ASKER
if my dll that is trying to retrieve the objectcontext is compiled and in mts then vb does run it fine.
then problem is that when i want to step thru the code that is trying to get the objectcontext, the context comes back as null.
i read the article that rkot2000 mentioned above.
"...
To facilitate application debugging using Visual Basic 6.0, a component that uses ObjectContext can
be debugged by enabling a special version of the object context. This debug-only version is enabled
by creating the registry key:
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Transact ion Server\Debug\RunWithoutCon text
Note that when running in debug mode, none of the functionality of MTS is enabled. GetObjectContext
will return the debug ObjectContext rather than returning Nothing.
..."
this is for windows NT 4.0. i never found anything on W2K. Right now, im just using conditional compliation to get around this. but, if this can be done in NT4.0 then it should be possible in W2K.
then problem is that when i want to step thru the code that is trying to get the objectcontext, the context comes back as null.
i read the article that rkot2000 mentioned above.
"...
To facilitate application debugging using Visual Basic 6.0, a component that uses ObjectContext can
be debugged by enabling a special version of the object context. This debug-only version is enabled
by creating the registry key:
HKEY_LOCAL_MACHINE\SOFTWAR
Note that when running in debug mode, none of the functionality of MTS is enabled. GetObjectContext
will return the debug ObjectContext rather than returning Nothing.
..."
this is for windows NT 4.0. i never found anything on W2K. Right now, im just using conditional compliation to get around this. but, if this can be done in NT4.0 then it should be possible in W2K.