%
' BEGIN USER CONSTANTS
Dim CONN_STRING
Dim CONN_USER
Dim CONN_PASS
' --------------------------------------------------------------------
' NOTE: Change the CONN_STRING below to match the DSN for this client.
' --------------------------------------------------------------------
'CONN_STRING = "DSN=agentlocator;"
CONN_STRING = "DBQ=" & Server.MapPath("agentlocator.mdb") & ";"
CONN_STRING = CONN_STRING & "Driver={Microsoft Access Driver (*.mdb)};"
'---------------------------------------------------------------
' This DB is unsecured, o/w you'd need to specify something here
'---------------------------------------------------------------
CONN_USER = ""
CONN_PASS = ""
'Our SQL code - overriding values we just set - comment out to use Access
'CONN_STRING = Application("SQLConnString")
'CONN_USER = Application("SQLUsername")
'CONN_PASS = Application("SQLPassword")
' END USER CONSTANTS
'-------------------
' BEGIN RUNTIME CODE
' Declare our vars
'-------------------
Dim iPageSize 'How big our pages are
Dim iPageCount 'The number of pages we get back
Dim iPageCurrent 'The page we want to show
Dim strOrderBy 'A fake parameter used to illustrate passing them
Dim strSQL 'SQL command to execute
Dim objPagingConn 'The ADODB connection object
Dim RS 'The ADODB recordset object
Dim iRecordsShown 'Loop controller for displaying just iPageSize records
Dim I 'Standard looping var
Dim strCompanyName 'Name to display on results pages.
'-------------------------------------------------------
' Build our SQL String using the parameters we just got.
'-------------------------------------------------------
strSQL = "SELECT DISTINCT Agencies.COUNTY FROM Agencies ORDER BY Agencies.COUNTY;"
' Now we finally get to the DB work...
' -------------------------------
' Create and open our connection
' --------------------------------
Set objPagingConn = Server.CreateObject("ADODB.Connection")
objPagingConn.Open CONN_STRING, CONN_USER, CONN_PASS
' ----------------
' Create recordset
' ----------------
Set RS = Server.CreateObject("ADODB.Recordset")
' -------
' Open RS
' -------
Set RS=objPagingConn.Execute(strSQL)
%>
Alliance Mutual Insurance Company | North Carolina | Finance