<%
if request("zip")<>"" or request("state") <> "" then
if request("zip")<>"" then
passpostal = request("zip")
else
Randomize()
passpostal = int(rnd() * (9999999 - 1111111 + 1))
end if
Set Cudas = Server.CreateObject("ADODB.Connection")
Cudas.Open Session("Conn_cudas")
if request("state") <> "" then
sql="SELECT states.state_name FROM states where states.state_name_short = '" & replace(request("state"),"'","") & "'"
Set rd = Cudas.Execute(sql)
if not rd.eof then
result_call = "Results for " & rd("state_name")
end if
rd.close
set rd = nothing
sql="select * from distributor where dststate = '" & replace(request("state"),"'","") & "' order by dstcity, dstname"
Set rd = Cudas.Execute(sql)
else
sql="select * from distributor where dstzip like '" & left(passpostal,3) & "%' order by dstzip, dstname"
result_call = "Results for zip code, “" & request("zip") & "”"
Set rd = Cudas.Execute(sql)
if rd.eof then
sql="select * from distributor where dstzip like '" & left(passpostal,2) & "%' order by dstzip, dstname"
Set rd = Cudas.Execute(sql)
if rd.eof then
sql="select * from distributor where dstzip like '" & left(passpostal,1) & "%' order by dstzip, dstname"
Set rd = Cudas.Execute(sql)
end if
end if
end if
%>
Store Locator
<%=result_call%>
<%
if rd.eof then
%>
Thanks for looking! Currently we don’t have a Cudas dealer near you. Please click on one of our online partners to grab some Cudas of your own.
<%
else
do until rd.eof
%>
<%=rd("dstname")%>
<%=rd("dstaddr1")%>
<%=rd("dstcity")%> <%=rd("dststate")%> <%=rd("dstzip")%>
<%=rd("dstphone")%>
<%
rd.movenext
loop
end if
rd.close
set rd = nothing
cudas.close
set cudas = nothing
else
%>

<%
end if
%>
Click to Tour
Check out some of our favorite retailers: