Solved

I have a problem with objContext.setComplete

Posted on 2001-06-20
7
585 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

617 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