by Tony Heishman (2 Submissions)
Category: Active Server Pages
Compatability: ASP (Active Server Pages)
Difficulty: Unknown Difficulty
Originally Published: Thu 25th May 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Populates a table with records returned from a database
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open strConnectionString
<html>
<table border="1" cellpadding="4" cellspacing="3" width="598" bordercolorlight="#000080">
<%Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM tblYourTable WHERE field = whatever "
RS.Open strSQL, connection
%>
<%While NOT RS.EOF%>
<td width="129" align="center"><font face="Arial"><font size="2"><%=RS("field1")%></font></font></td>
<td width="65" align="center"><font face="Arial"><font size="2"><%=RS("field2")%></font></font></td>
<td width="79" align="center"><font face="Arial"><font size="2"><%=RS("field3")%></font></font></td>
<td width="86" align="center"><font face="Arial"><font size="2"><%=RS("field4")%></font></font></td>
<td width="72" align="center"><font face="Arial"><font size="2"><%=RS("field5")%></font></font></td>
<td width="77" align="center"><font face="Arial"><font size="2"><%=RS("field6")%></font></font></td>
</tr>
<%RS.MoveNext
Wend
RS.Close
%>
</table>
</html>