Link to home
Start Free TrialLog in
Avatar of homeshopper
homeshopperFlag for United Kingdom of Great Britain and Northern Ireland

asked on

'error '800a000d' Type mismatch line 348

I am getting 'error '800a000d' Type mismatch line 348.
RowCount    = Session("strRowCount")
myArray     = Session("sessionmyArray")'error '800a000d' Type mismatch line 348
myArray(RowCount) = CString
For clarity the full code is below:
Thanks in advance for any help given.
<%
Sub BindData3()
currentPage = Request.QueryString("PageID")
if currentPage = 0 then
Response.Write("<div style='position:absolute;width:837px;height:366px;left:0px;top:260px;font-size:xx-small;overflow:auto;border:1px solid #722F90;' id='DIV999'>")
Response.Write("header2:" & currentPage & "#BindData3():<br/>")
Dim strRowArray2(20, 1)
Dim strRow    
Dim strColumn
Dim RowCount
Dim ColumnCount
strColumn = 1
CString = Session("sessionCString")
TableLabel = Session("sessionTableLabel")
RowCount = Session("strRowCount")
'****************************************
%>
<%
if RowCount = "" then
RowCount = 0
End if
Dim myArray()
ReDim Preserve myArray(RowCount) 'Re-Declaring a dynamic array
Session("sessionmyArray") = myArray
Response.Write("RowCount:" & RowCount & "#")
Response.Write ("Total element of the array = " & UBound(myArray) )
if RowCount = 0 then
myArray(RowCount) = CString
for i=0 to uBound(myArray)
Response.Write "<br>(" & i & ")" & myArray(i) & "#"
Next
Session("sessionmyArray") = myArray
response.write "<br/>array assigned to session var..."
Dim strRowArray
    strRowArray = Session("sessionmyArray") ' strRowArray(i, j)
    Dim oCounter : oCounter = 0
If IsArray(strRowArray) Then
      Dim strCountRow, strCountCol
      strCountRow  = UBound(strRowArray, 1)
      'strCountCol = UBound(strRowArray, 2) ' or the other way around...
      response.write "<br/>array dimensions: " & strCountRow & " x " & strCountCol
Else
      response.write "<br/>no array"
End If
else
RowCount    = Session("strRowCount")
myArray     = Session("sessionmyArray")'error '800a000d' Type mismatch line 348
myArray(RowCount) = CString
for i=0 to uBound(myArray)
Response.Write "<br>(" & i & ")" & myArray(i) & "#"
Next
Session("sessionmyArray") = myArray
response.write "<br/>array assigned to session var..."
strRowArray = Session("sessionmyArray") ' strRowArray(i, j)
oCounter = 0
If IsArray(strRowArray) Then
      strCountRow = UBound(strRowArray, 1)
      'strCountCol = UBound(strRowArray, 2) ' or the other way around...
      response.write "<br/>array dimensions: " & strCountRow & " x " & strCountCol
Else
      response.write "<br/>no array"
End If
end if
%>
<%
'****************************************
RowCount = RowCount + 1
Session("strRowCount") = RowCount
Response.Write("</div>")
end if  
End Sub
%>
<%
Select Case Request.Form("strButtonAction")
     Case "B1"
     BindData1()
     Case "B2"
     BindData2()
     Case "B3"
     BindData3()
     Case "B4"
     BindData4()
     Case "B5"
     BindData5()
     Case tempDefault
     txtProvider = Session("xtProvider")= "<font color='red'>NOT LOGGED IN!!</font>"
End Select
%>
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Are you using a single dimension or multi dimension array?  Are you treating them as zero based? See the example below.  First you set your initial array size  - arr(1) meaning 2 rows.  Then to add another 2 rows reset the size to 3(4 rows) but use the Preserve keyword to keep the original data, then add your 2 new rows.

<%
Dim myDynArray() 'Dynamic size array
ReDim myDynArray(1)
myDynArray(0) = "Albert Einstein"
myDynArray(1) = "Mother Teresa"

ReDim Preserve myDynArray(3)
myDynArray(2) = "Bill Gates"
myDynArray(3) = "Martin Luther King Jr."

For Each item In myDynArray
      Response.Write(item & "<br />")
Next
%>
Avatar of homeshopper

ASKER

Hi  robert_schutt,
Thank you for your help. I used your suggested code and it now clears the error.
I have just one further query. The array is incremented and displays the last data row.
That is fine, but previous row elements are lost. It is not preserving the complete data records entered. Thanks in advance for any help given.
Well, it seems to me that in this part of the code:
Dim myArray()
ReDim Preserve myArray(RowCount) 'Re-Declaring a dynamic array
Session("sessionmyArray") = myArray

Open in new window

you actually empty out the array in the Session. Have a good look at what you want to do, maybe that part can be skipped altogether?
I had not neglected the question, but have been away.
I have now got it all working, so will award the points.
The complete solution is below for others to see.
Thankyou for the help.
<%
Sub BindData3()
currentPage = Request.QueryString("PageID")
if currentPage = 0 then
Response.Write("<div style='position:absolute;width:837px;height:354px;left:0px;top:270px;font-size:xx-small;overflow:auto;border:1px solid #722F90;' id='DIV999'>")
Response.Write("header2:" & currentPage & "#BindData3():<br/>")
Dim strRowArray2(20, 1)
Dim strRow    
Dim strColumn
Dim RowCount
Dim ColumnCount
strColumn = 1
CString = Session("sessionCString")
TableLabel = Session("sessionTableLabel")
RowCount = Session("strRowCount")
'****************************************
%>
<%
if RowCount = "" then
RowCount = 0
End if
Dim myArray()
ReDim Preserve myArray(RowCount) 'Re-Declaring a dynamic array
'Session("sessionmyArray") = myArray
Response.Write("RowCount:" & RowCount & "#")
'Response.Write ("Total element of the array = " & UBound(myArray) )
if RowCount = 0 then
myArray(RowCount) = CString
for i=0 to uBound(myArray)
Response.Write "<br>(" & i & ")" & myArray(i) & "#"
Next
Session("sessionmyArray") = myArray
response.write "<br/>array assigned to session var..."
Dim strRowArray
    strRowArray = Session("sessionmyArray") ' strRowArray(i, j)
    Dim oCounter : oCounter = 0
If IsArray(strRowArray) Then
      Dim strCountRow, strCountCol
      strCountRow  = UBound(strRowArray, 1)
      'strCountCol = UBound(strRowArray, 2) ' or the other way around...
      response.write "<br/>array dimensions: " & strCountRow & " x " & strCountCol
Else
      response.write "<br/>no array"
End If
else
RowCount    = Session("strRowCount")
Dim myArrayTEMP
myArrayTEMP     = Session("sessionmyArray")'error '800a000d' Type mismatch line 348
ReDim Preserve myArrayTEMP(RowCount) 'Re-Declaring a dynamic array
myArrayTEMP(RowCount) = CString
for i=0 to uBound(myArrayTEMP)
Response.Write "<br>(" & i & ")" & myArrayTEMP(i) & "#"
Next
Session("sessionmyArray") = myArrayTEMP

response.write "<br/>array assigned to session var..."
strRowArray = Session("sessionmyArray") ' strRowArray(i, j)
oCounter = 0
If IsArray(strRowArray) Then
      strCountRow = UBound(strRowArray, 1)
      'strCountCol = UBound(strRowArray, 2) ' or the other way around...
      response.write "<br/>array dimensions: " & strCountRow & " x " & strCountCol
Else
      response.write "<br/>no array"
End If
end if
%>
<%
'****************************************
RowCount = RowCount + 1
Session("strRowCount") = RowCount
Response.Write("</div>")
end if  
End Sub
%>