Introduction
The following code will allow you to display the contents of a database table in an HTML table. The HTML table is built dynamically as the records are pulled out of the database. Minimal changes are necessary if you copy and paste this code - basically just change the DSN, table and field names. Note this example has an inner table for formatting purposes, but it is not necessary.
Code
<%@ Language="VBScript%">
<html>
<head>
<title>Display all Records</title>
</head>
<body>
<%
strSQL = "Select * from TableName;" 'create SQL string (where clauses etc
'should be added according to what you would like displayed)
SET DbObj = Server.CreateObject("ADODB.Connection") 'set up the
'ADO connection
DbObj.Open "DSN=DSNName","username","password" 'open the connection to
'the database, using DSN - set up the DSN in your control panel
SET oRs = DbObj.Execute(strSQL) 'Execute the SQL statement
%>
<center>
<%
DO WHILE NOT oRs.EOF
on error resume next
%>
<table border="1" width="100%" bordercolor="#00FFFF">
<tr>
<td width="35%">
<table border="0" width="96%">
<tr>
<td width="100%"><font color="#000080" size="4">
Display field description here: <% = oRs.Fields("FieldName") %></td>
</tr>
</table>
</td>
<font color="#000080" size="4">
<td width="65%"> <% = oRs.Fields("FieldName") %></td></font>
</tr>
</table>
<% oRs.MoveNext %>
<% Loop %> 'Go to the next record if not end of file
</center>
<% DbObj.Close
SET DbObj = Nothing
%>
</body>
</html>