<% session("connectionString") = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security " & _ "Info=False;Data Source=" & Server.MapPath(".") & "\SandAnalysis.mdb" dim Conn, rsDistance, rsTemp,rsDistancecal,rsCityfrom,rscityTo dim rsMajor , rsDist1 , rsDist2 , Dist1 , Dist2 Dim strFromCity , strToCity , strDistance ,str set Conn = server.CreateObject("ADODB.Connection") set rsDistance = server.CreateObject("ADODB.Recordset") set rsDistancecal = server.CreateObject("ADODB.Recordset") set rsCityfrom = server.CreateObject("ADODB.Recordset") set rsCityto = server.CreateObject("ADODB.Recordset") set rsTemp = server.CreateObject("ADODB.Recordset") set rsDist1 = server.CreateObject("ADODB.Recordset") set rsDist2 = server.CreateObject("ADODB.Recordset") set rsMajor = server.CreateObject("ADODB.Recordset") Conn.Open session("connectionString") strSql= "select city_id, city_name from city order by city_name" rsDistance.Open strSql, Conn function toProperCase(strValue) if len(strValue) > 1 then for i = 1 to len(strValue) if mid(strValue,i,1) = "(" then bflag = true End if if i = 1 then temp = temp & mid(strValue,i,1) Else if not bflag then temp = temp & lcase(mid(strValue,i,1)) Else temp = temp & mid(strValue,i,1) End if End if Next End if toProperCase = temp End function %>
Home | Contact Us | Employee Login  
<% if (Request.Form("cityfrom") <> "" and Request.Form("cityto") <> "") then if (Request.Form("cityfrom") <> "-- Select --" and Request.Form("cityto") <> "-- Select --") then rsDistancecal.Open "select dist_between from distance where (city_from=" & Request.Form("cityfrom") & "and city_to=" & Request.Form("cityto") & ") Or (city_from=" & Request.Form("cityto") & "and city_to=" & Request.Form("cityfrom") & ")" ,conn if rsDistancecal.EOF=false then strDistance=rsDistancecal("dist_between") & " kms" else 'Check According To To City Dist1 = 0 Dist2 = 0 rsMajor.Open "select MajorCity from city where city_id=" & cint(Request.Form("cityto")) ,conn if rsMajor.EOF =false then if rsMajor("MajorCity") = true Then rsDist1.open "select dist_between,City_From,City_To from distance where (city_from=" & Request.Form("cityto") & " Or city_to=" & Request.Form("cityto") & ")" ,conn if rsDist1.EOF =false then Dist1=rsDist1("Dist_between") if rsDist1("City_From") <> Request.Form ("CityTo") then rsDist2.open "select dist_between from distance where (city_from=" & Request.Form("cityfrom") & "and city_to=" & rsDist1("city_From") & ") Or (city_from=" & rsDist1("city_From") & "and city_to=" & Request.Form("cityfrom") & ")" ,conn if rsDist2.EOF = false then Dist2 = rsDist2("Dist_Between") end if else rsDist2.open "select dist_between from distance where (city_from=" & rsDist1("city_to") & "and city_to=" & Request.Form("cityfrom") & ") Or (city_from=" & Request.Form("cityfrom") & "and city_to=" & rsDist1("city_to") & ")" ,conn if rsDist2.EOF = false then Dist2 = rsDist2("Dist_Between") end if end if if ccur(Dist2)<> 0 then strDistance=(ccur(Dist1) + ccur(Dist2)) & " kms" else strDistance="No Entry" end if else strDistance="No Entry" end if Else 'Check According To From City rsDist1.open "select dist_between,City_From,City_To from distance where (city_from=" & Request.Form("cityfrom") & " Or city_to=" & Request.Form("cityfrom") & ")" ,conn if rsDist1.EOF =false then Dist1=rsDist1("Dist_between") if rsDist1("City_From") <> Request.Form ("CityFrom") then rsDist2.open "select dist_between from distance where (city_from=" & Request.Form("cityto") & "and city_to=" & rsDist1("city_from") & ") Or (city_from=" & rsDist1("city_from") & "and city_to=" & Request.Form("cityto") & ")" ,conn if rsDist2.EOF = false then Dist2 = rsDist2("Dist_Between") end if end if end if if ccur(Dist2)<> 0 then strDistance=(ccur(Dist1) + ccur(Dist2)) & " kms" else strDistance="No Entry" end if end if end if end if rsCityfrom.open "select city_name from city where city_id=" & Request.Form("cityfrom"),conn if rsCityfrom.EOF=false then strFromCity = rsCityfrom("city_name") else strFromCity="No Entry" end if rsCityto.open "select city_name from city where city_id=" & Request.Form("cityto"),conn if rsCityto.EOF=false then strToCity = rsCityto("city_name") else strToCity="No Entry" end if end if end if %>
 
From to
 
<%elseif (Request.Form("cityfrom") = "-- Select --" and Request.Form("cityto") = "-- Select --") then%>
0 kms
<%else%>
<%=toProperCase(strToCity)%>
<%=strDistance%>
<%end if%>
<% Dim strclass if len(trim(strToCity)) >13 then strclass="destinationTextlong" else strclass="destinationText" end if %> <% if (Request.Form("cityfrom") = "" and Request.Form("cityto") = "") then%>