asptoday_discuss thread: "type mismatch" when returning Split created array from COM in ASP
Hello All,
I am running into a problem when returning an "split created" array from a
VB component to an asp page. When I do a response.write vartype(array) I
get 8200 (vbArray + vbString). Here is my code:
This is the component sub that creates the array:
Private Sub GetHeader(ByRef o_prm_rs As ADODB.Recordset)
Dim s_lcl_Header As Variant
Dim o_lcl_Field As Variant
Dim I
For Each o_lcl_Field In o_prm_rs.Fields
s_lcl_Header = s_lcl_Header & o_lcl_Field.Name & ","
Next
'Remove the last comma and convert to array
s_lcl_Header = Split(Left(s_lcl_Header, Len(s_lcl_Header) - 1), ",")
v_gbl_RptHeader = s_lcl_Header
End Sub
Here is the property that returns the array:
Public Property Get FieldNames() As Variant
If Not IsArray(v_gbl_RptHeader) Then
Err.Raise Err.number, "ASPReport.GetFieldNames", "Must call
method 'GetData' before 'GetFieldNames'"
Else
FieldNames = v_gbl_RptHeader
End If
End Property
Here is the Call in the ASP page:
arrHeader = oReport.FieldNames
And here is where the error occurs:
<%
For I = 0 to UBound(arrHeader)
response.Write "<TD align='center'>" & arrHeader(I) & "</TD>"
next
%>
All variables in the com are types as Variant and all in ASP are of course
not typed.
PLEASE HELP!!!
thanks in advance
Jesus