PRB: "Error Loading DLL" When Returning User Defined Data Type from VB COM ObjectID: Q224397
|
When returning an Array or Collection of user defined data types (UDTs) from a Visual Basic COM object to Active Server Pages (ASP), the following error may occur:
Microsoft VBScript runtime error '800a0030'
Error Loading DLL: TestMethod
User defined data types are not supported in the current version of ASP.
Since ASP does not support UDTs, you can work around this by creating a new class to handle the data in place of the UDT and setting the instancing property to PublicNotCreateable. This will ensure that you can pass the necessary information to and from ASP, as well as that the class cannot be created outside of the DLL.
This behavior is by design.
Public Type TestUDT
strName as String
strDept as String
End Type
Public Function TestMethod()As Variant
Dim rtnArray(10) As Variant
Dim intCnt As Integer
For intCnt = 0 To 9
Dim udtTestData As TestUDT
udtTestData.strName = "Name"
udtTestData.strDept = "Department"
rtnArray(intCnt) = udtTestData
Next
TestMethod = rtnArray
End Function
<%
Dim objTest, udtArray, udtData
Set objTest = Server.CreateObject("VBUDTPrj.VBUDTObj")
udtArray = objTest.TestMethod()
udtData = udtArray(1)
Response.Write( "Name = " & udtData.strName & "<BR>" )
Response.Write( "Dept = " & udtData.strDept & "<BR>" )
%>
Microsoft VBScript runtime error '800a0030'
Error Loading DLL: TestMethod
Refer to the TYPE statement in the Visual Basic Documentation.
Additional query words:
Keywords : kberrmsg kbASP kbASP400 kbCOMt kbVBp500 kbVBp600 kbVBScript100 kbGrpASP
Version : WINDOWS:5.0,6.0; winnt:
Platform : WINDOWS winnt
Issue type : kbprb
Last Reviewed: May 25, 1999