Here is an example in ASP, it should get you where you need to go. Note this gives you a disconnected recordset, which is the preferred way to go as it releases the db connection back to the pool as quickly as possible:
<%@Language="VBScript"%>
<!-- Include file for VBScript ADO Constants -->
<!--#include File="adovbs.inc"-->
<%
' Connection string.
strCon = "Provider=sqloledb;Data Source=myServer;Initial Catalog=Northwind;User Id=myUser;Password=myPassword"
' Create the required ADO objects.
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.recordset")
' Open the connection.
conn.Open strCon
' Retrieve some records.
strSQL = "Select * from Shippers"
rs.CursorLocation = adUseClient
rs.Open strSQL, conn, adOpenStatic, adLockOptimistic
' Disconnect the recordset.
Set rs.ActiveConnection = Nothing
' Release the connection.
conn.Close
' Check the status of the connection.
Response.Write("<BR> Connection.State = " & conn.State)
Set conn = Nothing
' Use the diconnected recordset here.
Response.Write("Column1")
Response.Write("Column2")
' Release the recordset.
rs.Close
Set rs = Nothing
%>
You can get the full contents of adovbs.inc here.