ASP uses the ADO protocol. ADO stands for ActiveX Data Objects, and is the latest Microsoft technology for connecting to databases.

ADO is very flexible when it comes to creating connections.  For simplicity, we will stick to one way of doing it.

We will use the Connection and Recordset objects.  The steps are as follows:

Declare the variables.
Instantiate the Connection object.
Open the Connection.
Instantiate the Recordset object
Open the Recordset
Process the records
Close the Recordset and Connection
Set the objects to Nothing

The code would look like this:
[
][
]
   <%
      Option Explicit

      Dim objConnection
      Dim objRecordSet

      Set objConnection = Server.CreateObject("ADODB.Connection")
      objConnection.Open ""
      Set objRecordSet = Server.CreateObject("ADODB.RecordSet")
      objRecordSet = objConnection.Execute("")

      While Not objRecordSet.EOF
         ‘Processing goes here
      Wend

      objRecordSet.Close
      objConnection.Close

      Set objRecordSet = Nothing
      Set objConnection = Nothing
   %>
[
][
] A few notes on the code: Where you see , replace that with the actual Data Source Name you created in an earlier lesson. You still need the double-quotes around it, but not the angle brackets. Where you see , replace that with either an SQL Select statement or the name of a table or select query in the database. You still need the double-quotes around it, but not the angle brackets. Setting your objects to Nothing at the end helps speed up the process of freeing the memory.