Recordset to Table

Looping a Recordset and create a table

Response.Write("<table border=1>")

Response.Write("<tr>")
For i=0 To oRs.Fields.Count-1
Response.Write("<th>" & oRs(i).Name & "</th>")
Next
Response.Write("</tr>")


Do While NOT oRs.EOF
Response.Write("<tr>")
For i=0 To oRs.Fields.Count-1
Response.Write("<td>" & oRs(i).Value & "</td>")
Next
Response.Write("</tr>")
oRs.MoveNext
Loop

Response.Write("</table>")

Post a comment

Comments closed