Else
Radius = 3963.191
'Miles
End If
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("ConnectionString")
Set RS = Server.CreateObject("ADODB.Recordset")
' Rechercher codes postaux pour obtenir les coordonnées du premier point
' ---------------------------------------------------------
SQL = "SELECT * FROM [PostalCodes] " & ISO & "'
"
SQL = SQL & "AND PostalCode = '" & PostalCode & "';"
Set RS = Conn.Execute(SQL)
Lat = RS("Latitude")
Lon = RS("Longitude")
'Construisez la formule: la variable calculé pour l'instruction SQL
calc = Radius & " *
ACos( Cos(RADIANS(Latitude)) * Cos(RADIANS(" & Lat & ")) *
Cos(RADIANS(" & Lon & ") - RADIANS(Longitude)) + Sin(RADIANS(Latitude)) * Sin(RADIANS(" & Lat & ")) ) "
SQL = "SELECT TOP 100 "
SQL = SQL & "ISO, "
SQL = SQL & "Postalcode, "
SQL = SQL & "Region1, "
SQL = SQL & "Region2, "
SQL = SQL & "Region3, "
SQL = SQL & "Locality, "
SQL = SQL & "Suburb, "
SQL = SQL & "Latitude, "
SQL = SQL & "Longitude, "
SQL = SQL & calc & " AS Distance "
SQL = SQL & "FROM [PostalCodes] "
SQL = SQL & "WHERE (ISO = '" & ISO & "') "
SQL = SQL & "AND " & calc & " <= " & Distance & " "
SQL = SQL & "ORDER BY Distance ;"
Set RS = Conn.Execute(SQL)
DO While Not RS.EOF
Response.Write RS("ISO") & "<br>"
Response.Write RS("PostalCode") & "<br>"
Response.Write RS("Region1") & "<br>"
Response.Write RS("Region2") & "<br>"
Response.Write RS("Region3") & "<br>"
Response.Write RS("Locality") & "<br>"
Response.Write RS("Suburb") & "<br>"
Response.Write FormatNumber(RS("Distance"),1) & "<br>"
RS.MoveNext
Loop
RS.Close
Set RS = nothing
Conn.Close
%>
Compléments |
---|
Divisions administratives |
Pays |
Noms de pays |
Devises |
Langues |
Format de codes postaux |
Fuseaux horaires |
Formules et échantillons |
---|
Distance entre points |
Points dans un rayon |
Standard codes |
---|
ISO codes |
NGA codes |
NUTS codes |