ASP.NET交通信息网上查询系统(7)

来源:xiaoniu168.com 作者:本站原创 添加时间:2012-03-29 点击数:40506

计算机毕业设计介绍:

6.1.2 一次转乘查询
在一次转乘查询中,可以查询到从起点城市出发到终点城市,其间要经过的一个城市,以及要乘坐的2个交通工具的基本信息和中转城市的到达时间以及出发时间。
通过查询总体思路的派生,一次转乘查询的主要查询方法简化为以起点城市和终点城市作为结点,分别查询出连通该2个结点的通路,然后在这些通路的基础上,查找他们交汇的结点,此时,这些结点就为我们一次转乘的中转城市,而分别连通起点和终点结点的通路即为我们需要查询的交通路线。当用户以一次转乘查询提交或者在直达查询后通过超连接跳转到chaxun2.aspx页面。在chaxun2.aspx中,后台首先测试其中转城市是否存在,其SQL语句为:
select cityid,cityname from ctxx where cityid in
// 将所有经过起点城市的交通信息作为子集a
(select b.cityid from (select *  from bus where cityid=(select cityid from ctxx where cityname=@start))a,
//将所有经过起点城市的车的信息(主要查询到达城市)作为子集b
(select *  from bus where tid in(select tid from bus where cityid=(select cityid from ctxx where cityname=@start)))b,
//将所有经过终点城市的车的信息(主要查询到达城市)作为子集c
(select *  from bus where tid in(select tid from bus where cityid=(select cityid from ctxx where cityname=@ends)))c,
//将所有经过终点城市的交通信息作为子集d
(select *  from bus where cityid=(select cityid from ctxx where cityname=@ends))d
//起点和终点能到达的城市中相同的城市
where A.stops  < B.stops and a.tid=b.tid and c.stops  < d.stops and c.tid=d.tid and b.cityid=c.cityid)
若存在,则首先查询出中转城市名,即我们查询出通路的交叉结点,用dataset对象的table属性将返回结果保存起来。然后利用for循环,每次循环首先输出起点到中转城市的交通信息,然后再输出中转城市到终点城市的交通信息。
否则返回“无班次到达”的结果,并输出超连接,转到2转查询的chaxun3.aspx页面。

〖资料来源:计算机毕业论文 www.xiaoniu168.com

第8页为计算机毕业论文部分......

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网