dynamic multidemsion array
Can somebody please help me in creating this multideminsion array, I am pulling Dates from a database, there could be anywhere from 1 to 50 dates at any given time. I am trying to store the dates in an array to save from having to go back to the database countless times. My problem is lying in the Dim strDatesArray(20,3) I do not know how many dates the database will pull everytime. If I use strDatesArray(iRecordCount-1,3), I get an "Expected integer constant" error then if I try Redim strDatesArray(iRecordCount -1,3) it I get a "This array is fixed or temporarily locked" error. If I just leave the Dim strDatesArray(20,3) hard coded it works, but it's not dynamic enough.
Set objSelect = Server.CreateObject("ADODB.Recordset")
objSelect.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
iRecordCount = objSelect.RecordCount
If iRecordCount = 0 Then
Response.Write "<BR><BR>No dates are available.</TD></TR>"
Else
Dim strDatesArray(20,3)
For i = 0 to iRecordCount -1
strDatesArray(i,0) = objSelect("E_ID")
strDatesArray(i,1) = objSelect("E_Holiday")
strDatesArray(i,2) = objSelect("E_Day")
objSelect.MoveNext
Next
Redim strDatesArray(iRecordCount -1,3)
objSelect.Close
Set objSelect = Nothing
Dim intCounter
For intCounter = 0 To iRecordCount-1
Response.Write strDatesArray(intCounter,0) & "<BR>"
Response.Write strDatesArray(intCounter,1) & "<BR>"
Response.Write strDatesArray(intCounter,2) & "<BR><BR><BR>"
Next
End If
Thanks in advanced
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com
|