|
-
Apr 11th, 2002, 05:01 PM
#1
Thread Starter
New Member
Passing an Array from ASP to COM (that runs in MTS)
I have created a COM component that runs under MTS. It has a function that accepts an array as a parameter.
When I try to call that function from ASP I get an error:
Err.Number = 13
Err.Description: Type mismatch
Err.Source: VB Script runtime
The code that I use in ASP is:
<%@ Language=VBScript %>
<%
Dim str, obj, retval
str = "Some String"
dim ar(1,2)
ar(0,0) = "String1"
ar(0,1) = "String2"
ar(0,2) = "String3"
ar(1,0) = "String4"
ar(1,1) = "String5"
ar(1,2) = "String6"
set obj = Server.CreateObject("CompLib.Class1")
retval = obj.FuncName(ar,str)
%>
All the datatypes of parameters defined in COM are Variant
I would be very grateful if sb. can give me any suggestion.
-
Apr 12th, 2002, 03:01 AM
#2
Hyperactive Member
I suspect that your problem lies in the function parameter definition.
Based on the code you provided :
str = "Some String"
dim ar(1,2)
ar(0,0) = "String1"
ar(0,1) = "String2"
ar(0,2) = "String3"
ar(1,0) = "String4"
ar(1,1) = "String5"
ar(1,2) = "String6"
If the function declaration were like this :
FuncName(ByRef a() as variant, ByVal s as string) as variant
then this call ; retval = obj.FuncName(ar,str)
would fail and give you a type mismatch, however if you did this :
FuncName(ByRef a as variant, ByVal s as string) as variant
then you would be OK! 
Any help?
--
Anglo Saxon
-
Apr 12th, 2002, 07:42 AM
#3
Thread Starter
New Member
Thank you very much Anglo Saxon. Your solution worked fine.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|