📄 bus_show.asp
字号:
station_end_second_5=station_end_second_4(1) '前面可知station_end_second_4(0)是为了连接方便加上去的一段字符串,故不需要
for i=2 to Num_end_3
Check_4=""
station_end_second_6=split(station_end_second_5,"-")
Num_end_4=ubound(station_end_second_6)
for k=0 to Num_end_4
if station_end_second_6(k)=station_end_second_4(i) then '有相同的数据则删掉
Check_4="keer"
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 station_name='"& station_ahead_third_1(0) &"'"
else
sqlstr="select * from [Station] where station_name='"& station_ahead_third_1(0) &"'"
for i=1 to Num_ahead_5
sqlstr=sqlstr&" or station_name='"& station_ahead_third_1(i) &"'"
next
end if
route_ahead_third_1="!@#&%$"
rs.open sqlstr,conn,1,3
if not rs.eof then
while not rs.eof
route_ahead_third_1=route_ahead_third_1&"-"&rs("station_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 station_name='"& station_end_third_1(0) &"'"
else
sql="select * from [Station] where station_name='"& station_end_third_1(0) &"'"
for i=0 to Num_end_5
sql=sql&" or station_name='"& station_end_third_1(i) &"'"
next
end if
route_end_third_1="&$%#@!"
rs.open sql,conn,1,3
if not rs.eof then
while not rs.eof
route_end_third_1=route_end_third_1&"-"&rs("station_bus")
rs.movenext
wend
else
response.Write("数据库数据出错4!")
response.End()
end if
rs.close
'由于数据量比较大,所有在这里又要进行一次数据优化,把重复的线路去掉
'-------------------
'前面数据优化
route_ahead_third_2=split(route_ahead_third_1,"-")
Num_ahead_6=ubound(route_ahead_third_2)
route_ahead_third_3=route_ahead_third_2(1) '这里route_ahead_third_2(0)是前面赋上去的无效值,只为方便
for i=2 to Num_ahead_6
Check_5=""
route_ahead_third_4=split(route_ahead_third_3,"-")
Num_ahead_7=ubound(route_ahead_third_4)
for k=0 to Num_ahead_7
if route_ahead_third_4(k)=route_ahead_third_2(i) then
Check_5="keer"
end if
next
if Check_5="" then
route_ahead_third_3=route_ahead_third_3&"-"&route_ahead_third_2(i)
end if
next
'-------------------
'后面数据优化
route_end_third_2=split(route_end_third_1,"-")
Num_end_6=ubound(route_end_third_2)
route_end_third_3=route_end_third_2(1) '这里route_end_third_2(0)是前面赋上去的无效值,只为方便
for i=2 to Num_end_6
Check_6=""
route_end_third_4=split(route_end_third_3,"-")
Num_end_7=ubound(route_end_third_4)
for k=0 to Num_end_7
if route_end_third_4(k)=route_end_third_2(i) then
Check_6="keer"
end if
next
if Check_6="" then
route_end_third_3=route_end_third_3&"-"&route_end_third_2(i)
end if
next
route_ahead_third_5=split(route_ahead_third_3,"-")
Num_ahead_8=ubound(route_ahead_third_5)
route_end_third_5=split(route_end_third_3,"-")
Num_end_8=ubound(route_end_third_5)
route_middle="#45&6#$"
Check_7=""
for i=0 to Num_ahead_8
for j=0 to Num_end_8
if route_ahead_third_5(i)=route_end_third_5(j) then
route_middle=route_middle&"-"&route_ahead_third_5(i)
Check_7="keer"
end if
next
next
if Check_7="" then
call NonSearch(station1,station2)
response.Write("</div>")
%>
<!-- #include file="bottom.asp" -->
<%
response.End()
end if
route_middle_new=split(route_middle,"-")
Num_middle=ubound(route_middle_new)
'这里打开数据库读取出中间线路的相关信息
dim route_middle_name,station_middle_name
redim route_middle_name(i)
redim station_middle_name(i)
sqlstr=""
if Num_middle=1 then
sqlstr="select * from [Route] where route_name='"& route_middle_new(1) &"'"
else
sqlstr="select * from [Route] where route_name='"& route_middle_new(1) &"'"
for i=2 to Num_middle
sqlstr=sqlstr&" or route_name='"& route_middle_new(i) &"'"
next
end if
rs.open sqlstr,conn,1,3
if not rs.eof then
k=0
while not rs.eof
route_middle_name(k)=rs("route_name")
station_middle_name(k)=rs("route_address")
k=k+1
rs.movenext
wend
else
response.Write("数据库数据出错5!")
end if
rs.close
dim route_middle_info,NumMiddleFirstMax,NumMiddleSecondMax
redim route_middle_info(i),NumMiddleSecondMax(i)
NumMiddleFirstMax=k-1
for i=1 to NumMiddleFirstMax
route_middle_info(i)=split(station_middle_name(i),"-")
NumMiddleSecondMax(i)=ubound(route_middle_info(i))
next
'-----------------------------------------------
'以下是搜索二次换乘主要所需要的各个数据变量
'以下变量的值已经在上面查询的过程中给出
'route_ahead_name(i) 过起始站的公交路线数组
'route_ahead_info(i)(j) 过起始站的公交路线所经过的站点数组
'NumAheadFirstMax 过起始站的公交线路数
'NumAheadSecondMax(i) 过起始站的公交路线所经过的站点数
'---------
'route_middle_name(i) 中转路线数组
'route_middle_info(i)(j) 中转路线所经过的站点数组
'NumMiddleFirstMax 中转线路数
'NumMiddleSecondMax(i) 中转路线所经过的站点数
'---------
'route_end_name(i) 过终点站的公交路线数组
'route_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 route_ahead_info(i)(j)=route_middle_info(p)(q) then
station_change_1=station_change_1&"/"&route_ahead_info(i)(j)
end if
next
for n=0 to NumEndSecondMax(m)
if route_end_info(m)(n)=route_middle_info(p)(q) then
station_change_2=station_change_2&"/"&route_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='route_show.asp?q="& route_ahead_name(i) &"'><font color='#FF0000'>"&route_ahead_name(i)&"</font><a> 到 ("&station_change_1&") 再乘 <a href='route_show.asp?q="& route_middle_name(p) &"'><font color='#FF0000'>"&route_middle_name(p)&"</font></a> 到 ("&station_change_2&") 最后乘坐 <a href='route_show.asp?q="& route_end_name(m) &"'><font color='#FF0000'>"&route_end_name(m)&"</font></a> 便可到达!</li><br>")
call SearchRate3(route_ahead_name(i),route_middle_name(p),route_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 + -