Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 2nd, 2003, 08:48 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Object variable or With block variable not set

I'm having problems accessing an ActiveX Dll that I wrote from within an ASP Page. It works fine in VB but I get the following error when I call it from and ASP Page. I have spent the last 2 days searching the web for an answer to my problem but to no avail. I have read that it might have something to do with the DLL Registration, but I've shutdown IIS, unregistered the DLL, rebooted my PC, and recompiled & Registered the DLL. This hasn't worked.

Error Type:
CIMCmdSocket (0x800A005B)
Object variable or With block variable not set
/1.asp, line 14

The ASP Code is as follows

Dim x
Set x = Server.CreateObject("CIMCmdSocket.CmdSocket")
x.opensocket(Port) ' SocketNumber is the actual port
Set x = Nothing

If anyone has any suggestions/help I would be most grateful.
  #2 (permalink)  
Old July 2nd, 2003, 06:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Back in the dim dark days long ago I remember getting this error, but I'm afraid I can't remember what caused it. Actually it is now coming back. The problem may be a type mismatch between the DLL and the ASP page. ASP is a weakly typed language ie all data is variant, VB is a strongly typed language. Try explicitly converting the value of Port into the datatype VB is going to receive it as eg:
x.opensocket(CInt(Port))

Alternatively, change the type of the Port parameter in the function/sub to Variant. One other way to test things is to change the function so that it doesn't take a parameter and (for the short term) hard code the value into the function.

It's a while since I worked with this stuff so this may not be the problem.

regards
David Cameron
  #3 (permalink)  
Old July 3rd, 2003, 06:17 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think you need to check the datatype and direction of your parameters in the DLL. If you're using out parameters (ByRef), make sure you set their type to Variant. Then do some proper casting inside the method to the type you expect.

Check out:

http://support.microsoft.com:80/supp...NoWebContent=1

for more info.

If this doesn't help, post some of the code from the VB method.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #4 (permalink)  
Old July 3rd, 2003, 10:07 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your replies.

I eventually got it to work but am confused as to why it never worked in the first place. My code is still exactly the same. It must have been something with the DLL registration!!! 3 days later and still none the wiser! But at least it works!
  #5 (permalink)  
Old February 23rd, 2007, 01:52 AM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

may i know how it works... since i am also facing the same problem

  #6 (permalink)  
Old March 8th, 2007, 03:34 PM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You might want to start a new post, and also better describe the problem you are facing.

Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems


Similar Threads
Thread Thread Starter Forum Replies Last Post
"object variable or with block variable not set" netfresher ASP.NET 1.0 and 1.1 Basics 1 June 12th, 2006 03:50 PM
object variable or with block variable not set Aoude BOOK: Beginning VB.NET Databases 1 February 24th, 2006 05:21 PM
Object variable or With block variable not set tparrish VB Databases Basics 1 May 25th, 2005 10:25 AM
Object variable or With block variable not set tparrish VS.NET 2002/2003 3 May 22nd, 2005 07:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.