Bryan wrote:
I have a results table that is 5 columns wide. the recordset is
returned with 48 items. I have no problem displaying 5 per row until I
hit the last row where i get a ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.
My question is how do I close of the table row when I reach the EOF?
i.e
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 * *
I need to display empty cells (in place of the *'s)or end the row when
there is no data to fill it...how is this done?
Thank you.
Just a variation on Ken's suggestion.
dim rs,arData,,i,iRow,iRows, iRecords
'After opening the recordset, do this:
If not rs.EOF then arData = rs.GetRows
rs.Close: Set rs=nothing
'close and destroy the connection as well
if isarray(arData) then
response.write "<table rules=cols " & _
"style=""border-collapse:collapse;width:200px"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
'determine the number of table rows
iRecords = ubound(arData,2)+1
iRows = Int(iRecords/5)
if iRows < iRecords/5 then
iRows = iRows + 1
end if
for iRow = 0 to iRows -1
Response.Write "<tr>"
for i = iRow * 5 to iRow * 5 + 4
Response.Write "<td>"
if i <= ubound(arData,2) then
Response.Write arData(0,i)
else
Response.Write " "
end if
Response.Write "</td>"
next 'i
Response.Write "</tr>"
next 'iRow
response.write "</table>"
else
response.write "no records were returned"
end if
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"