S
Steve
Hi All:
I've managed to get myself into something I thought would be simple, and is
turning out not to be, or I am too close to the trees to see the forest.
I am creating a recordset from a table in an access database using classic
ASP.
I now need to display the database in a table in a web page, which is
normally simple enough, but the twist is I need to display the items in
order in a fixed number of columns (4) and the number of rows are determined
dynamically in itemID order going from left to right. For instance:
itemID1 itemID2 itemID3 ItemID4
itemID5 itemID6 itemID7 itemID8
I have some code that will display this data like this:
itemID1 itemID3 itemID5 ItemID7
itemID2 itemID4 itemID6 itemID8
however, this does not work for this project.
This is the code I am using to create the second layout...could anyone take
a look to see what I can do to get the required result?
intColumns = 4
response.write "recCount=" & objRs.RecordCount & "
"
response.write "rows=" & objrs.RecordCount * ((i+1)/(intColumns)) & "
"
redim ColumnArray(intColumns-1)
for i = 0 to ubound(ColumnArray)
ColumnArray(i) = objrs.RecordCount * ((i+1)/(intColumns))
next
redim DataArray(objrs.RecordCount/(intColumns-1),intColumns)
for i = 0 to intColumns-1
k = 0
do while j < ColumnArray(i)
DataArray(k,i) = objRs("itemID")
j = j + 1
k = k + 1
objrs.MoveNext
loop
next
<table border=1 width=600 align=center>
<%
for i = 0 to ubound(DataArray)
Response.Write("<tr>")
for j = 0 to intColumns - 1
Response.Write("<td>")
if DataArray(i,j) <> "" then
Response.Write(DataArray(i,j))
else
Response.Write(" ")
end if
Response.Write("</td>")
next
Response.Write("</tr>")
txtContinue = ""
for j = 0 to intColumns
txtContinue = txtContinue & DataArray(i+1,j)
next
if txtContinue = "" then Exit For end if
next
%>
</table>
Thanks
Steve
I've managed to get myself into something I thought would be simple, and is
turning out not to be, or I am too close to the trees to see the forest.
I am creating a recordset from a table in an access database using classic
ASP.
I now need to display the database in a table in a web page, which is
normally simple enough, but the twist is I need to display the items in
order in a fixed number of columns (4) and the number of rows are determined
dynamically in itemID order going from left to right. For instance:
itemID1 itemID2 itemID3 ItemID4
itemID5 itemID6 itemID7 itemID8
I have some code that will display this data like this:
itemID1 itemID3 itemID5 ItemID7
itemID2 itemID4 itemID6 itemID8
however, this does not work for this project.
This is the code I am using to create the second layout...could anyone take
a look to see what I can do to get the required result?
intColumns = 4
response.write "recCount=" & objRs.RecordCount & "
"
response.write "rows=" & objrs.RecordCount * ((i+1)/(intColumns)) & "
"
redim ColumnArray(intColumns-1)
for i = 0 to ubound(ColumnArray)
ColumnArray(i) = objrs.RecordCount * ((i+1)/(intColumns))
next
redim DataArray(objrs.RecordCount/(intColumns-1),intColumns)
for i = 0 to intColumns-1
k = 0
do while j < ColumnArray(i)
DataArray(k,i) = objRs("itemID")
j = j + 1
k = k + 1
objrs.MoveNext
loop
next
<table border=1 width=600 align=center>
<%
for i = 0 to ubound(DataArray)
Response.Write("<tr>")
for j = 0 to intColumns - 1
Response.Write("<td>")
if DataArray(i,j) <> "" then
Response.Write(DataArray(i,j))
else
Response.Write(" ")
end if
Response.Write("</td>")
next
Response.Write("</tr>")
txtContinue = ""
for j = 0 to intColumns
txtContinue = txtContinue & DataArray(i+1,j)
next
if txtContinue = "" then Exit For end if
next
%>
</table>
Thanks
Steve