Select a Category:
<%
'First, create Connection and Recordset objects
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
'Open the connection to the ODBC source, in this case the Access database
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(".") & "\adp1.mdb"
'Create the SQL statements
CategorySQL = "SELECT * FROM Category"
'Execute the SQL statement and set the recordset object to the result of the execution.
'We obtain the resulting records in Rs object
Set Rs = Conn.Execute(CategorySQL)
'Use this Recordset object to populate the HTML output stream
Response.Write ("
")
'While there are more categories, display them
Do While NOT Rs.EOF
Response.Write(" |
")
' Move to the next record in the resultset
Rs.MoveNext
Loop
Response.Write("
")
' Close the Recordset object and destroy it
'Rs.Close
' We will to release the resources for connection object.
' We want to release the resources unless we want to use
' the same connection again in the later code.
Conn.Close
Set Conn = Nothing
%>