PDA

Click to See Complete Forum and Search --> : business component


bezeredi
Nov 28th, 2001, 09:18 AM
I keep getting this error when trying to run this script:
<%
Set objComponent = Server.CreateObject ("Test.Builder")
objComponent.ProcessQuery
%>

The error is:
"Object variable or With block variable not set"

I checked my code and it looks alright. Any suggestion on how to debug?

alex_read
Nov 28th, 2001, 10:05 AM
<% Dim MyDllRef, MyDllFunction

'create a reference to your actual dll
If not isobject(MyDllRef) then
set MyDllRef= server.CreateObject("MyProject.Myclass")
End if

'and again, using the SET keyword again,
'call your dll's sub or function :
Set MyDllFunction = MyDllRef.FunctionNo1_TheLarch
%>

bezeredi
Nov 28th, 2001, 11:43 AM
Damn, still get the same error. Do you think it is my code in the component or just they way I call the component.

alex_read
Nov 29th, 2001, 02:13 AM
It could be:
1) The naming of the dll (i.e. if you left it as project1, this causes an error when trying to reference it from a new vb project with the same name).
2) The dll is not registered on your pc properly - I'd check the regsvr program and add this to the components services mmc snap in if you use NT, 2000 or XP.
3) The instancing property of the class module you're calling is set wrong.
4) There's something wrong with your code.

You can check no4 by putting in a dummy function :
Public function TestIt() as Boolean
On error goto Jail

Dim i as integer
For i = 0 to 11
debug.print i
Next i

TestIt = True

Jail :
TestIt = false
End Function
That way, if you call this from the ASP page & get a value :
Set MyDllFunction = MyDllRef.FunctionNo1_TheLarch
response.write MyDllFunction You'll know that the dll's up & running, & referenced okay, but there's something wrong in your other function.

Tell me - are you using Interdev to do your ASP pages ?

bezeredi
Nov 29th, 2001, 09:16 AM
I tried the test function but still get the same error message.
I'm pretty sure it's not my code. I don't think my dll is not registered properly. Right now the the only copy of the dll is in the folder which I created the project.

I think this is how you register it:
regsvr32 test.dll

I ran this but got an error:
Load library("test.dll") failed

By the way I'm use FrontPage 2000, if it makes a difference.

alex_read
Nov 29th, 2001, 09:24 AM
2 options :

1) Start Menu > Run > Type in :
Regsvr32 "C:\Path\File.dll"
The path is important here ;)

2) Check this one out... (http://www.vbforums.com/showthread.php?s=&postid=673587)