<%@ Language="VBScript" %> <% Option Explicit %> Display Guest Book
<% 'declare your variables Dim connection, recordset Dim sSQL, sConnString 'declare SQL statement that will query the database sSQL="SELECT * FROM Users_tbl ORDER BY id DESC" 'create an ADO connection and recordset object Set connection = Server.CreateObject("ADODB.connection") Set recordset = Server.CreateObject("ADODB.Recordset") 'define the connection string, specify database 'driver and the location of database sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("/admin/guestbook/users.mdb") 'Open the connection to the database Connection.Open sConnString 'Open the recordset object, executing the SQL Recordset.Open sSQL, Connection 'Looping through the records until the end of the records Do while Not recordset.eof %>
Date : <% Response.Write " " & recordset("thedate")%>
Name : <% Response.Write " " & recordset("name") %>
Overview : <% Response.Write " " & recordset("overview")%>
Comments : <% Response.Write " " & recordset("comments") %>
   
<% recordset.MoveNext loop 'Now close the recordset and the connection object recordset.Close Set recordset = Nothing connection.Close Set connection = Nothing %>