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
Solved

I have a problem with objContext.setComplete

Posted on 2001-06-20
7
580 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

837 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