PDA

Click to See Complete Forum and Search --> : ActiveX component can't create object


lenin
Sep 27th, 2000, 03:21 AM
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

André
Sep 27th, 2000, 04:15 AM
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é

lenin
Sep 27th, 2000, 04:27 AM
Hi Andre,
thanks for the prompt response, but I have already registered the dll. Should have noted this is my earlier post. sorry.

Lenin

lenin
Sep 27th, 2000, 07:23 AM
Sorry for hassle the issue was related t permission on a dll that was referenced from the component

Lenin