% on error resume next dim strCity dim strState dim strZip(9) dim strMall dim intMall 'ADO variables dim objConn dim objRS dim blnDbState dim adCmdText dim strSQL dim sngErrorFound dim ix ix = 0 intMall = 0 'session("strConn") = "PROVIDER=SQLOLEDB;SERVER=www.bryant-online.com;DATABASE=EZWeb;UID=D1009864;PWD=morrobay" session("strConn") = "PROVIDER=SQLOLEDB;SERVER=sql4.webminders.com;DATABASE=isn;UID=isn;PWD=re5*x24!" 'Main logic call GetMallIdent if intMall = 0 then Response.Redirect("index.htm") end if call GetCityZip 'Get the mall identity sub GetMallIdent() intMall = Request.Form("mall") if intMall = "" then intMall = Request.QueryString("mall") end if 'next line for testing only 'intMall = 2 session("intMall") = intMall end sub 'Search database sub GetCityZip() on error resume next ' build SQL query strSQL = "select zip_5, city_name, state_name from zip as z left outer join city as c on c.city_ident = z.city_ident left outer join state as s on c.state_ident = s.state_ident where z.city_ident = " strSQL = strSQL & intMall strSQL = strSQL & " ORDER BY zip_5 " ' establish database connection strConn = session("strConn") Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open (strConn) blnDbState = objConn.State ' create recordset object Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open strSQL, objConn, adOpenDynamic, adLockReadOnly, adCmdText sngErrorFound = objConn.Errors.Count blnDbState = objRS.State if blnDbState then objRS.MoveFirst if objRS.EOF then call NoResults else while not objRS.EOF strZip(ix) = objRS("zip_5") strCity = objRS("city_name") strState = objRS("state_name") ix = ix + 1 objRS.MoveNext wend end if end if objRS.Close objConn.Close end sub %>