<%
option explicit
Response.Buffer = True
dim ColumnArray(), DataArray()
dim intColumns, sql, i, j, k, txtContinue
dim rs, Conn
'Get Database Connection Script %>
<%
intColumns = 2
sql = "SELECT txtSiteName, txtLink, txtDescription "
sql = sql & "FROM tblASPSites "
sql = sql & "ORDER BY txtSiteName"
set rs = server.CreateObject("ADODB.Recordset")
rs.Open sql, Conn, adOpenStatic
redim ColumnArray(intColumns-1)
for i = 0 to ubound(ColumnArray)
ColumnArray(i) = rs.RecordCount * (i+1)/(intColumns)
next
'dimensionalize the array to hold 3 pieces of additional info
redim DataArray(rs.RecordCount/(intColumns-1),intColumns,3)
for i = 0 to intColumns - 1
k = 0
do while j < ColumnArray(i)
DataArray(k,i,0) = rs("txtSiteName")
DataArray(k,i,1) = rs("txtLink")
'txtLink is the url of the Site
DataArray(k,i,2) = j + 1
'records the record #
DataArray(k,i,3) = rs("txtDescription")
'txtDescription is a description of the Site
j = j + 1
k = k + 1
rs.MoveNext
loop
next
rs.Close
set rs = Nothing
conn.Close
set conn = Nothing
%>
<%'Write a header column %>
align=center>Popular ASP Sites
(ordered alphabetically)
<%
for i = 0 to ubound(DataArray)
Response.Write("")
for j = 0 to intColumns - 1
Response.Write("")
if DataArray(i,j,0) <> "" then
'Write the number, site name, and hyperlink in the first cell
Response.Write(DataArray(i,j,2) & ". " & "" & DataArray(i,j,0) & "")
else
Response.Write(" ")
end if
Response.Write(" ")
Response.Write("")
if DataArray(i,j,0) <> "" then
'Write the description of the site in the second cell
Response.Write(DataArray(i,j,3))
else
Response.Write(" ")
end if
Response.Write(" ")
next
Response.Write(" ")
txtContinue = ""
for j = 0 to intColumns - 1
txtContinue = txtContinue & DataArray(i+1,j,0)
next
if txtContinue = "" then Exit For end if
next %>