Results 1 to 4 of 4

Thread: ActiveX component can't create object

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    Hi,
    I have an issue with s small component I am trying to implement using ASP. I get the error message

    Error Type:
    Microsoft VBScript runtime (0x800A01AD)
    ActiveX component can't create object
    /xml/toXML.asp, line 9

    I don't think I am doing anything wrong in creating the object.


    <?xml version="1.0"?>

    <Tony_Test>
    <%
    dim lrs_test
    set lrs_test = Server.CreateObject("ADODB.Recordset")
    Set lo_AcX = Server.CreateObject("A362ADO.ActiveX36")

    set lrs_test = lo_AcX.getFields

    Do While Not lrs_test.EOF
    %>
    <acx_test>
    <number><%=lrs_test("CUSTNO")%></number>
    </acx_test>

    <%lrs_test.MoveNext

    loop
    %>
    </Tony_Test>

    I can create the object no problem in the VB environment by referencing the dll. Also by adding the source project to my test project. However using ASP fails on the server.createobject line, despite the fact that the source must have a handle on the type library since it locates the one and only function in the component ( apart from class initialisation )

    I have added the Vb source also for completeness.
    The source itself basically adds elements from a collection to a client side dummy recordset and returns this.

    Any help appreciated.

    Private host As UNIBOL36Host
    Private lf_file As UNIBOL36File
    Private fields As UNIBOL36Fields

    Public Function getFields() As ADODB.Recordset

    '//========================================================================
    '//========================================================================
    '//
    '// function:
    '// Iterate through fields colection add to recordset and return
    '//
    '//========================================================================
    '//========================================================================

    Dim lrs_rec As New ADODB.Recordset
    Dim cn As New ADODB.Connection


    lrs_rec.CursorLocation = adUseClient
    cn.Open "Provider=MSDataShape;Data Provider=NONE;"


    ' Create a new field in the recordset
    strShape = "SHAPE APPEND NEW adInteger AS CUSTNO"

    lrs_rec.Open strShape, cn, adOpenStatic, adLockOptimistic, -1



    ' Add a UnibolField
    Dim field As UNIBOL36Field

    ' While there are records to read
    Do While Not lf_file.EOF

    For Each field In fields
    ' populate text box for possible update
    If field.Name = "CUSTNO" Then
    lrs_rec.AddNew
    lrs_rec!custno = field.Value
    ' txtResult.Text = field.Value
    End If
    Next

    lf_file.ReadNext
    Loop

    'Return values from the collection as a recordset
    Set getFields = lrs_rec

    End Function



    Private Sub Class_Initialize()

    '//=======================================================================
    '//=======================================================================
    '//
    '// Connect to the Host Server, and Open File
    '//
    '//=======================================================================
    '//=======================================================================

    Set host = New UNIBOL36Host

    host.Name = "mars"
    host.UserName = "tony"
    host.UserPassword = "lenin12"

    host.Connect

    ' Check connection
    If host.Connected Then
    ' Open File
    Set lf_file = host.OpenFile("A.ARCST", "CSTMST", u36_READWRITE, u36_READ_KEYED, True)
    ' Set the fields collection to point to the file object
    Set fields = lf_file.fields
    End If
    End Sub

    Private Sub Class_Terminate()
    ' Set host = Nothing
    End Sub

  2. #2
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    Hi there,
    Where is your ASP project?
    On the server?
    If it is then you must run regsvr32 for your dll on the server.

    Interdev can locate the local dll, hence you can see the public method, but when you run the project, then you are asking the server to create the object, so the server needs the registered dll.

    Hope this helps, let me know

    André

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    Hi Andre,
    thanks for the prompt response, but I have already registered the dll. Should have noted this is my earlier post. sorry.

    Lenin

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    Sorry for hassle the issue was related t permission on a dll that was referenced from the component

    Lenin

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