?? bus_show.asp
字號:
Check_4="qm"
end if
next
if Check_4="" then
station_end_second_5=station_end_second_5&"-"&station_end_second_4(i)
end if
next
'站點數據優化結束
'---------------------------------------------------------------------------------
'這里開始查二次換乘的方案
'-----------------------------------
'這里組合出sqlstr字符串,再通過各條件生成sqlstr語句,查過station1的所有車經過的所有站點,且過這些站點的所有公交車
'-----------------------------------
station_ahead_third_1=split(station_ahead_second_5,"-")
Num_ahead_5=ubound(station_ahead_third_1)
sqlstr=""
if Num_ahead_5=0 then
sqlstr="select * from [Station] where qmstation_name='"& station_ahead_third_1(0) &"'"
else
sqlstr="select * from [Station] where qmstation_name='"& station_ahead_third_1(0) &"'"
for i=1 to Num_ahead_5
sqlstr=sqlstr&" or qmstation_name='"& station_ahead_third_1(i) &"'"
next
end if
qmroute_ahead_third_1="!@#&%$"
rs.open sqlstr,conn,1,3
if not rs.eof then
while not rs.eof
qmroute_ahead_third_1=qmroute_ahead_third_1&"-"&rs("qmstation_bus")
rs.movenext
wend
else
response.Write("數據庫數據出錯3!")
response.End()
end if
rs.close
'-----------------------------------
'這里組合出sql字符串,再通過各條件生成sql語句,查過station2的所有車經過的所有站點,且過這些站點的所有公交車
'-----------------------------------
station_end_third_1=split(station_end_second_5,"-")
Num_end_5=ubound(station_end_third_1)
sql=""
if Num_end_5=0 then
sql="select * from [Station] where qmstation_name='"& station_end_third_1(0) &"'"
else
sql="select * from [Station] where qmstation_name='"& station_end_third_1(0) &"'"
for i=0 to Num_end_5
sql=sql&" or qmstation_name='"& station_end_third_1(i) &"'"
next
end if
qmroute_end_third_1="&$%#@!"
rs.open sql,conn,1,3
if not rs.eof then
while not rs.eof
qmroute_end_third_1=qmroute_end_third_1&"-"&rs("qmstation_bus")
rs.movenext
wend
else
response.Write("數據庫數據出錯4!")
response.End()
end if
rs.close
'由于數據量比較大,所有在這里又要進行一次數據優化,把重復的線路去掉
'-------------------
'前面數據優化
qmroute_ahead_third_2=split(qmroute_ahead_third_1,"-")
Num_ahead_6=ubound(qmroute_ahead_third_2)
qmroute_ahead_third_3=qmroute_ahead_third_2(1) '這里qmroute_ahead_third_2(0)是前面賦上去的無效值,只為方便
for i=2 to Num_ahead_6
Check_5=""
qmroute_ahead_third_4=split(qmroute_ahead_third_3,"-")
Num_ahead_7=ubound(qmroute_ahead_third_4)
for k=0 to Num_ahead_7
if qmroute_ahead_third_4(k)=qmroute_ahead_third_2(i) then
Check_5="qm"
end if
next
if Check_5="" then
qmroute_ahead_third_3=qmroute_ahead_third_3&"-"&qmroute_ahead_third_2(i)
end if
next
'-------------------
'后面數據優化
qmroute_end_third_2=split(qmroute_end_third_1,"-")
Num_end_6=ubound(qmroute_end_third_2)
qmroute_end_third_3=qmroute_end_third_2(1) '這里qmroute_end_third_2(0)是前面賦上去的無效值,只為方便
for i=2 to Num_end_6
Check_6=""
qmroute_end_third_4=split(qmroute_end_third_3,"-")
Num_end_7=ubound(qmroute_end_third_4)
for k=0 to Num_end_7
if qmroute_end_third_4(k)=qmroute_end_third_2(i) then
Check_6="qm"
end if
next
if Check_6="" then
qmroute_end_third_3=qmroute_end_third_3&"-"&qmroute_end_third_2(i)
end if
next
qmroute_ahead_third_5=split(qmroute_ahead_third_3,"-")
Num_ahead_8=ubound(qmroute_ahead_third_5)
qmroute_end_third_5=split(qmroute_end_third_3,"-")
Num_end_8=ubound(qmroute_end_third_5)
qmroute_middle="#45&6#$"
Check_7=""
for i=0 to Num_ahead_8
for j=0 to Num_end_8
if qmroute_ahead_third_5(i)=qmroute_end_third_5(j) then
qmroute_middle=qmroute_middle&"-"&qmroute_ahead_third_5(i)
Check_7="qm"
end if
next
next
if Check_7="" then
call NonSearch(station1,station2)
response.Write("</div>")
%>
<!-- #include file="bottom.asp" -->
<%
response.End()
end if
qmroute_middle_new=split(qmroute_middle,"-")
Num_middle=ubound(qmroute_middle_new)
'這里打開數據庫讀取出中間線路的相關信息
dim qmroute_middle_name,station_middle_name
redim qmroute_middle_name(i)
redim station_middle_name(i)
sqlstr=""
if Num_middle=1 then
sqlstr="select * from [Route] where qmroute_name='"& qmroute_middle_new(1) &"'"
else
sqlstr="select * from [Route] where qmroute_name='"& qmroute_middle_new(1) &"'"
for i=2 to Num_middle
sqlstr=sqlstr&" or qmroute_name='"& qmroute_middle_new(i) &"'"
next
end if
rs.open sqlstr,conn,1,3
if not rs.eof then
k=0
while not rs.eof
qmroute_middle_name(k)=rs("qmroute_name")
station_middle_name(k)=rs("qmroute_address")
k=k+1
rs.movenext
wend
else
response.Write("數據庫數據出錯5!")
end if
rs.close
dim qmroute_middle_info,NumMiddleFirstMax,NumMiddleSecondMax
redim qmroute_middle_info(i),NumMiddleSecondMax(i)
NumMiddleFirstMax=k-1
for i=1 to NumMiddleFirstMax
qmroute_middle_info(i)=split(station_middle_name(i),"-")
NumMiddleSecondMax(i)=ubound(qmroute_middle_info(i))
next
'-----------------------------------------------
'以下是搜索二次換乘主要所需要的各個數據變量
'以下變量的值已經在上面查詢的過程中給出
'qmroute_ahead_name(i) 過起始站的公交路線數組
'qmroute_ahead_info(i)(j) 過起始站的公交路線所經過的站點數組
'NumAheadFirstMax 過起始站的公交線路數
'NumAheadSecondMax(i) 過起始站的公交路線所經過的站點數
'---------
'qmroute_middle_name(i) 中轉路線數組
'qmroute_middle_info(i)(j) 中轉路線所經過的站點數組
'NumMiddleFirstMax 中轉線路數
'NumMiddleSecondMax(i) 中轉路線所經過的站點數
'---------
'qmroute_end_name(i) 過終點站的公交路線數組
'qmroute_end_info(i)(j) 過終點站的公交路線所經過的站點數組
'NumEndFirstMax 過終點站的公交線路數
'NumEndSecondMax(i) 過終點站的公交路線所經過的站點數
'--------------------------------------------------'
'所有數據到齊后,現在開始循環查詢
'把所有個別要用到的變量清空
i=""
j=""
p=""
q=""
m=""
n=""
for p=1 to NumMiddleFirstMax
for i=0 to NumAheadFirstMax
for m=0 to NumEndFirstMax
station_change_1=""
station_change_2=""
for q=0 to NumMiddleSecondMax(p)
for j=0 to NumAheadSecondMax(i)
if qmroute_ahead_info(i)(j)=qmroute_middle_info(p)(q) then
station_change_1=station_change_1&"/"&qmroute_ahead_info(i)(j)
end if
next
for n=0 to NumEndSecondMax(m)
if qmroute_end_info(m)(n)=qmroute_middle_info(p)(q) then
station_change_2=station_change_2&"/"&qmroute_end_info(m)(n)
end if
next
next
if station_change_1<>"" and station_change_2<>"" then
station_change_1_new=split(station_change_1,"/")
if ubound(station_change_1_new)=1 then
station_change_1="<a href='station_show.asp?q="&station_change_1_new(1)&"'>"&station_change_1_new(1)&"</a>"
else
station_change_1="<a href='station_show.asp?q="&station_change_1_new(1)&"'>"&station_change_1_new(1)&"</a>"
for k=2 to ubound(station_change_1_new)
station_change_1=station_change_1&"<font color='#FF0000'>/</font><a href='station_show.asp?q="&station_change_1_new(k)&"'>"&station_change_1_new(k)&"</a>"
next
end if
station_change_2_new=split(station_change_2,"/")
if ubound(station_change_2_new)=1 then
station_change_2="<a href='station_show.asp?q="&station_change_2_new(1)&"'>"&station_change_2_new(1)&"</a>"
else
station_change_2="<a href='station_show.asp?q="&station_change_2_new(1)&"'>"&station_change_2_new(1)&"</a>"
for k=2 to ubound(station_change_2_new)
station_change_2=station_change_2&"<font color='#FF0000'>/</font><a href='station_show.asp?q="&station_change_2_new(k)&"'>"&station_change_2_new(k)&"</a>"
next
end if
response.Write("<br><li>坐 <a href='qmroute_show.asp?q="& qmroute_ahead_name(i) &"'><font color='#FF0000'>"&qmroute_ahead_name(i)&"</font><a> 到 ("&station_change_1&") 再乘 <a href='qmroute_show.asp?q="& qmroute_middle_name(p) &"'><font color='#FF0000'>"&qmroute_middle_name(p)&"</font></a> 到 ("&station_change_2&") 最后乘坐 <a href='qmroute_show.asp?q="& qmroute_end_name(m) &"'><font color='#FF0000'>"&qmroute_end_name(m)&"</font></a> 便可到達!</li><br>")
call SearchRate3(qmroute_ahead_name(i),qmroute_middle_name(p),qmroute_end_name(m))
end if
next
next
next
response.Write("<br>由于沒有查到有直達的或是一次換乘的車,所以本系統給出二次換乘的乘車方案!")
response.Write("</div>")
%>
<!-- #include file="bottom.asp" -->
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -