• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 598
  • Last Modified:

I have a problem with objContext.setComplete

Dear Friends,

     I have a problem when i complete my transaction and execute objContext.setComplete. It gives an error message object variable with block variable not set. I am using COM+ in my business services and data services. I have written the sample code which i follow in my procedures.

Public Function ValidateUser(passingArgs)as RetArgs
On Error Goto ErrHandler
   Dim objContext as COMSVCSLib.ObjectContext
   Set objContext = GetObjectContext()
   
   'Few Code Here
   objContext.SetComplete '->> This Generates an Error

   'After Successful completion of code when
   'i use SetComplete it shows an Error Message that
   'object variable with block variable not set.

   Exit Function

ErrHandler:
   objContext.SetAbort
End Function

Waiting for your Answer.

Thanks in Advance

Mihir Gandhi
0
Mihir1977
Asked:
Mihir1977
1 Solution
 
nutwissCommented:
you should be able to call GetObjectContext.SetComplete
direct without a variable (in fact this is a more suitable solution)

Have you implemented the Object Control interface?

you'll need to add the lines:


Implements ObjectControl

Private Sub ObjectControl_Activate()

End Sub

Private Function ObjectControl_CanBePooled() As Boolean
    ObjectControl_CanBePooled = True
End Function

Private Sub ObjectControl_Deactivate()

End Sub


okay?

BTW has the object got its transaction mode property set to anything other than 0 - NotAnMTSObject?
0
 
rkot2000Commented:
I got the same error in the vbide.

Microsoft claims that SP2 for windows 2000 should fix that error.
I can?t upgrade to windows 2000, so I am using the following:  


If IsIDE = False Then
  GetObjectContext.SetComplete
End If

Private Function IsIDE() As Boolean
  On Error Resume Next
  Debug.Assert 1 / 0
  If Err.Number = 0 Then
    IsIDE = False
  Else
    IsIDE = True
  End If
End Function


for nt4.0 you need to create a key : [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Transaction Server\Debug\RunWithoutContext]
0
 
rkot2000Commented:
on support.microsoft.com
Q261871 - all info on debuging com+/mts
Q244807 PRB: Object Required Error for ObjectContext Under Windows 2000 in Visual Basic IDE and Active Server Pages

you don't need to inplement Object Control interface or use Set objContext = GetObjectContext().

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
nutwissCommented:
q244807 doesn't exist anymore on microsoft.com...

then they had the gaul to ask me to fill in a survey of how useful I found the 'Article' (read '404')

So I did! :)
0
 
DanRollinsCommented:
Hi Mihir1977,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept rkot2000's comment(s) as an answer.

Mihir1977, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
rkot2000Commented:
for debuging under windows 2000 you need to set
MTSTransactionMode to (NoTransactions or RequiresTransaction or UsesTransaction or RequiresNewTransaction)
by default you have : NotAnMTSObject :))

0
 
Computer101Commented:
Comment from expert accepted as answer

Computer101
E-E Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now