Displaying recordsets

S

Steve Marciniak

I'm trying to display different recordsets (which are 1 field each) as
columns right next to one another. For example, Recordset1 is
displayed on the left hand side of the screen. Recordset2 is displayed
immediately to the right of then first recordset with the first rows
or each at the same level. Recordset3 is displayed to the right of
Recordset2 and so on. There is no set limit to the number of possible
recordsets (or columns to display). Imagine a spreadsheet where each
column is a different recordset. How can I display that using ASP?
 
A

Aaron [SQL Server MVP]

The first idea would be to write a better query so there aren't n recordsets
at all?
 
J

Jeff Cochran

I agree with Aaron on the recordsets, but if you must do this, you'll
need to display the recordset using a table. As you loop through the
recordset, build everything in a table cell, then close the tag and
move to the next record and next cell.

Something like (Code is likely not going to work as written, I type
too poorly and am doing this from a feeble memory...):

(Assumes you have a recordset objRS)

Response.Write <table><tr>
Do While Not objRS.EOF
Response.Write <td>
For Each Field in objRS.Fields
Response.Write Field.Value & "<br>"
Next
Response.Write </td>
objRS.MoveNext
Loop
Response.Write </tr></table>

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top