Centripetal
asked on
ASP problem with COM
I'm writing a COM for ASP. I want to return an array, so I return in a Variant, and it returns fine. But the VBScript will not let me subscript the returned array. I used, TypeName, IsArray, UBound, and LBound, and all are saying it's an array. Just gives me type mismatch when I try subscripting it.
Better post the code.
I'm guessing that you're probably returning an array of some type in a variant. Try returning an array of variants-- as opposed to an array of strings in a variant, for example.
E.g.,
Example1 won't work. VBScript will give you a type-mismatch when you try to access an array member. UBound, LBound, IsArray will all work-- it's returning a SafeArray, but the items within it are typed, so VBScript complains.
function example1() as variant
dim s(1) as string
s(0) = "hello"
s(1) = "there"
example1 = s
end function
Instead try this:
function example2() as variant
dim s(1) as variant
s(0) = "hello"
s(1) = "there"
example2 = s
end function
E.g.,
Example1 won't work. VBScript will give you a type-mismatch when you try to access an array member. UBound, LBound, IsArray will all work-- it's returning a SafeArray, but the items within it are typed, so VBScript complains.
function example1() as variant
dim s(1) as string
s(0) = "hello"
s(1) = "there"
example1 = s
end function
Instead try this:
function example2() as variant
dim s(1) as variant
s(0) = "hello"
s(1) = "there"
example2 = s
end function
ASKER
That did it Clockwatcher, that you very much for the help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Answer accepted