WEB LISTING 1: Database.asp <% Const g_modName = "Database.asp" Function GetDSN() GetDSN = "DSN=datacon;uid=sa;pwd=" End Function Function ConvertToString(v) If IsNull(v) Then ConvertToString = "" Else ConvertToString = CStr(v) End If End Function Function RunSQL(strSQL) 'On error resume next. ' Set up command and connection objects. Dim cmd Set cmd = CreateObject("ADODB.Command") 'Run the procedure. cmd.ActiveConnection = GetDSN() cmd.CommandText = strSQL cmd.CommandType = adCmdText cmd.Execute , , ADODB.adExecuteNoRecords Set cmd.ActiveConnection = Nothing Set cmd = Nothing End Function Function RunWithRS( strSQL) 'On error resume next ' set up command and connection objects. Dim rs , cmd Set rs = CreateObject("ADODB.Recordset") Set cmd = CreateObject("ADODB.Command") 'Run the procedure. cmd.ActiveConnection = GetDSN() cmd.CommandText = strSQL cmd.CommandType = adCmdText rs.CursorLocation = adUseClient rs.Open cmd, , adOpenForwardOnly, adLockReadOnly Set cmd.ActiveConnection = Nothing Set cmd = Nothing 'Set rs.ActiveConnection = Nothing Set RunWithRS = rs End Function Function RunWithRS_RW( strsql) ‘on error resume next. ' Set up command and connection objects. Dim rs, cmd Set rs = server.createobject("ADODB.Recordset") Set cmd = server.createobject("ADODB.Command") 'Run the procedure. cmd.ActiveConnection = GetDSN() cmd.CommandText = strsql cmd.CommandType = adCmdText rs.CursorLocation = adUseClient rs.Open cmd, , adOpenDynamic, adLockBatchOptimistic Set cmd = Nothing Set RunWithRS_RW = rs End Function Function RunWithRS_RWS( strsql) on error resume next. ' Set up command and connection objects. Dim rsrw, cmd Set rsrw = server.createobject("ADODB.Recordset") Set cmd = server.createobject("ADODB.Command") 'Run the procedure. cmd.ActiveConnection = GetDSN() cmd.CommandText = strsql cmd.CommandType = adCmdText rsrw.CursorLocation = adUseServer rsrw.Open cmd, , adOpenDynamic, adLockOptimistic Set cmd = Nothing Set RunWithRS_RWS = rsrw End Function Function GetStateList(StateProvince) dim sStates set rs = RunWithRS("Select * from States order by stateid") sStates = "" i = 0 Do while not rs.eof sStates = sStates & "" rs.MoveNext loop GetStateList = sStates End Function Function GetCountryList(SelectedCountry) dim sCountries, CurrentCountry set rs = RunWithRS("Select * from Countries order by Countryid") SelectedCountry = UCase(Trim(SelectedCountry)) sCountries = "" i = 0 Do while not rs.eof sCountries = sCountries & "" rs.MoveNext loop GetCountryList = sCountries End Function %>