<% 'Dimension variables Dim adoCon 'Holds the Database Connection Object Dim rsMSTFF 'Holds the recordset for the records in the database Dim strSQL 'Holds the SQL query to query the database 'Create an ADO connection object Set adoCon = Server.CreateObject("ADODB.Connection") 'Set an active connection to the Connection object using a DSN-less connection adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &Server.MapPath("mstff2006.mdb") 'Create an ADO recordset object Set rsMSTFF = Server.CreateObject("ADODB.Recordset") 'Initialise the strSQL variable with an SQL statement to query the database strSQL = "SELECT Table1.Teacher, Table1.School, Table1.Grade, Table1.Students, Table1.Adults FROM Table1;" 'Open the recordset with the SQL query rsMSTFF.Open strSQL, adoCon 'Loop through the recordset Do While not rsMSTFF.EOF 'Write the HTML to display the current record in the recordset Response.Write ("
") Response.Write (rsMSTFF("Teacher")) Response.Write ("
") Response.Write (rsMSTFF("School")) Response.Write ("
") Response.Write (rsMSTFF("Grade")) Response.Write ("
") Response.Write (rsMSTFF("Students")) Response.Write ("
") Response.Write (rsMSTFF("Adults")) Response.Write ("
") 'Move to the next record in the recordset rsMSTFF.MoveNext() Loop 'Reset server objects rsMSTFF.Close Set rsMSTFF= Nothing Set adoCon = Nothing %>