| |
PLEASE
CALL THE STORE BEFORE YOU VISIT THEM
TO INQUIRE ABOUT THE ITEM YOU ARE LOOKING FOR, AS NOT
ALL CUSTOMERS CARRY GOLDWATER'S ENTIRE PRODUCT LINE.
|
<%
' Code starts here
'on error resume next
' uncoment in final version
yourzip = request("YOURZIP")
if len(yourzip) < 5 then
' show main form
%>
|
<%
else
' start results handling
' ---- the data is safe process it
Set Connection = Server.CreateObject("ADODB.Connection")
SName = Request.ServerVariables("APPL_PHYSICAL_PATH")
DName = "dsn.dsn"
DBName = "zip99.mdb"
FName = "_private\"
Fdsn = SName & FName & DName
Dbpath = SName & FName & DBName
'Connection.Open "Provider=Microsoft.Jet.SQLOLEDB.4.0;Data Source=" & Dbpath
Connection.Open "filedsn=" & Fdsn & "; DBQ=" & Dbpath &";","",""
SQLStmt = "SELECT ZIP5.ZIP5, ZIP5.CITY, STATES.STATENAME, ZIPLOC.LONGITUDE, ZIPLOC.LATITUDE "
SQLStmt = SQLStmt & "FROM (ZIP5 INNER JOIN ZIPLOC ON ZIP5.ZIP5 = ZIPLOC.ZIP_CODE) INNER JOIN STATES ON ZIP5.STATE = STATES.STATE "
SQLStmt = SQLStmt & "WHERE ZIP5.ZIP5 ='"& YOURZIP & "'"
set fp_rs = CreateObject("ADODB.Recordset")
fp_rs.Open SQLStmt, Connection, "1"
If fp_rs.EOF then
response.write " Please try again. "
else
'
do while fp_rs.EOF = false
' if there are any results then serve the table
%>
You are in
<% response.write fp_rs("CITY") & ", " & fp_rs("STATENAME") & " "
'response.write "LONG: " & fp_rs("LONGITUDE") & " LATITUDE: " & fp_rs("LATITUDE")
along = fp_rs("LONGITUDE")
alat = fp_rs("LATITUDE")
fp_rs.MoveNext
loop
fp_rs.close
set fp_rs = nothing
connection.Close
set connection = nothing
' start search
Set Connection = Server.CreateObject("ADODB.Connection")
SName = Request.ServerVariables("APPL_PHYSICAL_PATH")
DName = "dsn.dsn"
DBName = "zip99.mdb"
FName = "_private\"
Fdsn = SName & FName & DName
Dbpath = SName & FName & DBName
'Connection.Open "Provider=Microsoft.Jet.SQLOLEDB.4.0;Data Source=" & Dbpath
Connection.Open "filedsn=" & Fdsn & "; DBQ=" & Dbpath &";", "",""
SQLStmt = "SELECT cust1.ORDER_DATE ,cust1.NAME, cust1.ST_ADDRESS_1, cust1.ST_ADDRESS_2, cust1.ST_CITY_AND_STATE, cust1.ST_ZIP, cust1.PHONE_NO, cust1.CAT,cust1.CUSTOMER, cust1.HOLD, ZIPLOC.LATITUDE, ZIPLOC.LONGITUDE, SQR(ABS(((ZIPLOC.LONGITUDE-" & ALONG & ")*(ZIPLOC.LONGITUDE-" & ALONG & "))+((ZIPLOC.LATITUDE-" & ALAT & ")*(ZIPLOC.LATITUDE-" & ALAT & ")))) AS distance, ZIP5.CITY, STATES.STATENAME "
SQLStmt = SQLStmt & "FROM ((cust1 INNER JOIN ZIPLOC ON cust1.ST_ZIP = ZIPLOC.ZIP_CODE) INNER JOIN ZIP5 ON ZIPLOC.ZIP_CODE = ZIP5.ZIP5) INNER JOIN STATES ON ZIP5.STATE = STATES.STATE "
SQLStmt = SQLStmt & "WHERE (((((cust1.CAT)<>1 And (cust1.CAT)<>2 And (cust1.CAT)<>7 And (cust1.CAT)<>14 Or (cust1.CAT) Is Null))) and cust1.ORDER_DATE > #" & DATEADD("M",-12,DATE()) & "#) AND (cust1.HOLD = 'No')"
SQLStmt = SQLStmt & "ORDER BY SQR(ABS(((ZIPLOC.LONGITUDE-" & ALONG & ")*(ZIPLOC.LONGITUDE-" & ALONG & "))+((ZIPLOC.LATITUDE-" & ALAT & ")*(ZIPLOC.LATITUDE-" & ALAT & "))))"
set fp_rs = CreateObject("ADODB.Recordset")
fp_rs.Open SQLStmt, Connection, dbopensnapshot
If fp_rs.EOF then
response.write " Please try again. "
else
'fp_rs1 = fp_rs
'fp_rs1.sort "distance"
'fp_rs.sort "distance"
'
if fp_rs("distance") > 1 then
%>
<%
end if
do while fp_rs.EOF = false and norecs < 10 AND fp_rs("distance") < 1.5
norecs = norecs + 1
' if there are any results then serve the table
%>
<%
RESPONSE.WRITE " " & fp_rs("NAME")&" "
IF LEN(fp_rs("ST_ADDRESS_1")) > 0 THEN RESPONSE.WRITE "" & fp_rs("ST_ADDRESS_1")&" "
IF LEN(fp_rs("ST_ADDRESS_2")) > 0 THEN RESPONSE.WRITE "" & fp_rs("ST_ADDRESS_2")&" "
response.write fp_rs("CITY") & ", " & fp_rs("STATENAME") & " "
response.write "ZIP: " & fp_rs("ST_ZIP") &" "
response.write "PHONE: " & fp_rs("PHONE_NO") &" "
'DIST = fp_rs("distance")
'RESPONSE.WRITE "DISTANCE: " & (DIST*67)
'RESPONSE.WRITE "" & fp_rs("")
%>
<%
fp_rs.MoveNext
loop
fp_rs.close
set fp_rs = nothing
connection.Close
set connection = nothing
end If
end if
END IF
%>
To order
directly from Goldwater's foods
call 1-800.488.4932
or
Order
Securely Online.
for a list of Goldwater's Foods retailers.
|
|
| |