This is a demo shows how to take a Recordset and write out the data using the NAME property and all data associated with that Name. This was something I ran across and found very useful. Its very nice when presenting data in HTML.
This is what the data looks like once its been selected and written out.
id
EmailAddress
Homepage
1
johndoe@blah.com
http://www.someurl.com
2
blahman@blah.com
http://www.someurl.com
3
Aperson@blah.com
http://www.someurl.com
4
Jane@blah.com
http://www.somewhere.com
5
henry@blah.com
http://www.someURL.com
Here is the code that created the table presented above
<%@ Language = "VBScript"%> <% response.buffer = true On Error Resume Next
<html><head> <title>Write out headers</title></head><body>
<TABLE BORDER="1" width="80%"><TR> 'This section writes out the Names of the fields in the Recordset
<% For Each Field In RS.Fields %>
<TH>
<% If Field.Name <> "ID" Then
response.write Field.name
End If %>
</TH>
<% Next %> </TR>
'This section writes out the DATA of the fields in the Recordset<% Do While Not RS.EOF %> <TR> <% For Each Field In RS.Fields %> <TD ALIGN=center> <%If IsNull(Field) Then
Response.Write ""
Else
Response.Write Field.Value
End If %>
</TD><% Next
RS.MoveNext %>
</TR> <% Loop %> </TABLE>
<% Rs.Close Set Rs = Nothing %>
<p> </p> </body> </html> <% conn.close set conn = nothing %>