Solved

I have a problem with objContext.setComplete

Posted on 2001-06-20
7
572 Views
Last Modified: 2007-12-19
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
Comment
Question by:Mihir1977
7 Comments
 
LVL 4

Expert Comment

by:nutwiss
ID: 6209962
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
 
LVL 5

Accepted Solution

by:
rkot2000 earned 120 total points
ID: 6210318
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
 
LVL 5

Expert Comment

by:rkot2000
ID: 6210353
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 4

Expert Comment

by:nutwiss
ID: 6210531
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 7139580
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
 
LVL 5

Expert Comment

by:rkot2000
ID: 7140643
for debuging under windows 2000 you need to set
MTSTransactionMode to (NoTransactions or RequiresTransaction or UsesTransaction or RequiresNewTransaction)
by default you have : NotAnMTSObject :))

0
 
LVL 1

Expert Comment

by:Computer101
ID: 7173282
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now