Problem with loop and array
I have a page that needs to display records in two columns. I have code written to pull the recordsets, turn it into an array, then divide it into two. It puts the first half in the first column, then the 2nd half in the 2nd column. There is a different number of records depending on the query. The problem is that when it gets to the second column, it is repeating the records.
Here is the code
<%
dim aRS, x,y
aRS = RS.GetRows() ' Note this turns the Recordset into an array
RS.close ' We don't need the recordset anymore
x = ubound(aRS,2) / 2 ' get the midpoint of the array
y = 0
do while y < x
if x + y < ubound(aRS,2) then
response.write "<tr><td><b>" & aRS(1,y) & "</b>: " & aRS(2,y) & "</td><td><b>" & aRS(1,x+y) & ":</b> " & aRS(2,x+y) & "</td></tr>"
else
response.write "<tr bgcolor=""white""><td>" & aRS(1,y) & "</td><td> </td></tr>"
end if
y = y + 1
loop
%>
|