📄 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 + -