I have a couple of routines that might be of use to you. The first is called transpose. This uses the getrows function to create an array out of GetRows, converting rows to columns and columns to rows. Its useful if you want to paste the data into Excel.
function TransposeRS(oRS, IncHdr)
‘//////////////////////////////////// this routine converts recordsets to arrays for easy insert into OWC
dim lCurrField
dim lCurrRow
dim lFieldCount
dim lRowCount
dim tempArray()
dim vArray
‘------------------------ convert recordset to array
oRS.MoveFirst
vArray = oRS.GetRows
‘------------------------ get size
lRowCount = UBound(vArray, 2)
lFieldCount = UBound(vArray, 1)
ReDim tempArray(lRowCount + IncHdr, lFieldCount - 0)
‘------------------------ include field names if needed
if IncHdr = 1 then
For lCurrField = 0 To lFieldCount
tempArray(0, lCurrField) = oRS.Fields(lCurrField).Name
Next
end if
‘------------------------ transpose from fields in rows to fields in columns
For lCurrRow = 0 To lRowCount
For lCurrField = 0 To lFieldCount
tempArray(lCurrRow + IncHdr, lCurrField) = vArray(lCurrField, lCurrRow)
Next
Next
TransposeRS = tempArray
end function
The second routine just prints a table from a recordset. It seems that is what you want to do. Basically, I open up the recordset in the main asp code, then call the routine. If I want to see the headers more than once, I set the LineToBreak parameter to a value of about 25, else I make it 1000.
Its a down and dirty routine, but its fast. When you want to create a format, its easy to customize the style.
sub PrintRecordList(LinesToBreak)
dim i, nFld, j, cnt
nFld = oRS.fields.count - 1
Response.Write "<table cellspacing=1 cellpadding=1 border=1 WIDTH=800px><tr>"
for i = 0 to nFld
Response.Write "<td align=left><font face=arial size=2><strong>" & oRS.fields(i).name & "</strong></td></font>"
next
Response.Write "</tr>"
while not(oRS.EOF) and (nFld > 0)
cnt = cnt + 1
Response.Write "<tr>"
for i = 0 to nFLd
if isnull(oRS.fields(i).value) then
Response.Write "<td align=left><font face=arial size=1> </td></font>"
else
if len(oRS.fields(i).value) = 0 then
Response.Write "<td align=left><font face=arial size=2> </td></font>"
else
Response.Write "<td align=left><font face=arial size=2>" & oRS.fields(i).value & "</td></font>"
end if
end if
next
Response.Write "</tr>"
oRS.MoveNext
if cnt mod LinesToBreak = 0 and not(oRS.eof) then
Response.Write "</table><P>"
response.flush
Response.Write "<table cellspacing=1 cellpadding=1 border=1 WIDTH=800px><tr>"
for i = 0 to nFld
Response.Write "<td align=left><font face=arial size=2><strong>" & oRS.fields(i).name & "</strong></td></font>"
next
Response.Write "</tr>"
end if
wend
Response.Write "</table><P> " & cnt & " record(s) found"
end sub