Results 1 to 6 of 6

Thread: business component

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    43

    Question business component

    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?

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Code:
    <% 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
    %>
    Last edited by alex_read; Nov 28th, 2001 at 11:08 AM.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    43
    Damn, still get the same error. Do you think it is my code in the component or just they way I call the component.

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    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 :
    Code:
    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 :
    Code:
    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 ?

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    43
    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.

  6. #6
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    2 options :

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

    2) Check this one out...

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width