人人范文网 范文大全

列车时刻表查询小结

发布时间:2020-03-02 05:13:42 来源:范文大全 收藏本文 下载本文 手机版

列车时刻表查询小结

信息0911-2009822103-刘绘

本章主要讲述的是通过列车时刻表查询程序怎样对Google地图的二次开发,从而在网站上创建功能全面的地图应用

一、Google地图API是一种通过javaScript将Google地图嵌入到网页的API。它提供了很多处理地图的功能和地图添加内容的服务,从而在网站上创建功能全面的地图应用

1.熟练使用地图查找你所要查看的某个具体的地址 2.找到某个地方火车站的经纬度

3.显示某个列车的行走路线,一般是折线图,将坐标点连起来,一般是最短路线 4.叠加层是地图上绑定到经度纬度坐标的对象,会随您拖动或缩放地图而移动。叠加层用于反映您添加到地图上以指明点、线或区域的对象,代码如下

var map; var geocoder; var siteName=[<%=strSiteList%>]; var siteLocation = new Array(); function initialize() {

var myLatLng = new google.maps.LatLng(31.587074,120.305551); var myOptions = { zoom: 4, center: myLatLng, mapTypeId: google.maps.MapTypeId.ROADMAP };

map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);

geocoder = new google.maps.Geocoder(); for (var i = 0; i

codeAddre(i); } }

function codeAddre(i) { var addre=siteName[i]; geocoder.geocode( { \'addre\': addre}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { //alert(addre + \":\" +results[0].geometry.location); siteLocation.push(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location, title:addre }); //画线

var flightPath = new google.maps.Polyline({ path: siteLocation, strokeColor: \"#FF0000\", strokeOpacity: 1.0, strokeWeight: 2, map:map });

} else { alert(\"Geocode was not succeful for the following reason: \" + status); } }); } function Button1_onclick() { var meage =\'this\'; new window.alert(meage);

二、数据库

1、数据库只需要一张表

2、新建系统存储过程Proc_GetStationListByID,Proc_GetTrainDetailByNo,Proc_GetTrainListByFromTo,Proc_GetTrainListByNO,Proc_GetTrainListByStation用以存储数据。其实存储过程就和函数差不多 将常处理的业务写成一个存储过程,要用到是只要调用就可以了,具体可以参照函数理解,什么情况下用?一般在开发中,分工明确的都是数据库程序员写好存储过程,业务程序员要操作数据库时只需调用存储过程,传入相应参数,然后获取返回结果就可以了 。

3、Proc_GetTrainListByFromTo的存储过程如下:

set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go

ALTER PROCEDURE [dbo].[Proc_GetTrainListByFromTo]

AS BEGIN select t1.[ID] as 车次,t1.[Type] as 列车类型, t1.Station as 始发站,t1.D_Time as 发车时间, @StartStation varchar(50), @EndStation varchar(50)

t2.Station as 终点站,t2.A_Time as 到站时间, t2.[Day] as 天数,t2.Distance as 里程, t3.Station as 出发站,t3.A_Time as 出发站到站时间, t3.D_Time as 出发站发车时间,t3.[Day] as 出发站天数, t4.Station as 目的站,t4.A_Time as 目的站到站时间, t4.D_Time as 目的站发车时间,t4.[Day] as 目的站天数, --票价

dbo.Fun_GetPriceByFromTo(t1.[ID],t3.S_No,t4.S_No) as 票价 from (

select * from train where [ID] in (

select distinct t1.id from ( select * from train where station like \'%\'+@StartStation+\'%\' ) t1 join ( select * from train where station like \'%\'+@EndStation+\'%\' ) t2 on t1.id=t2.id and t1.s_no

select * from train where [ID] in (

select distinct t1.id from ( select * from train where station like \'%\'+@StartStation+\'%\' ) t1 join ( select * from train where station like \'%\'+@EndStation+\'%\' ) t2 on t1.id=t2.id and t1.s_no

) t3 on t1.id=t3.id join ( select * from train where station like \'%\'+@EndStation+\'%\' ) t4 on t1.id=t4.id END

三、Train程序编写

1、新建一个调用类Query,用来调用系统存储过程

public static DataTable GetTrainListByID(string id) { DataTable dt = new DataTable(); //........ SqlParameter[] parms = new SqlParameter[1]; parms[0] = new SqlParameter(\"@NO\", SqlDbType.VarChar, 50); parms[0].Value = id; DataSet ds = DbHelperSQL.RunProcedure(\"Proc_GetTrainListByNO\", parms, \"ds\"); dt = ds.Tables[0]; return dt; }

2、通常我们在程序中需要调用WebService时,都是通过“添加Web引用”,让VS.NET环境来为我们生成服务代理,然后调用对应的Web服务。这样是使工作简单了。

[WebMethod] public DataTable GetTrainListByID(string id) { return Query.GetTrainListByID(id); }

[WebMethod] public DataTable GetTrainListByStation(string station) { return Query.GetTrainListByStation(station); } [WebMethod] public DataTable GetTrainListByFromTo(string from, string to) { return Query.GetTrainListByFromTo(from, to); }

列车时刻表项目小结

邯郸高铁列车时刻表

京沪高铁列车时刻表

03ET1单板故障查询小结

武广高铁列车时刻表

数据库查询基本操作题总结(查询小结)

京广高铁最新列车时刻表(推荐)

郑州到北京 高铁列车时刻表

合福高铁铜陵北站列车时刻表

营业执照查询

列车时刻表查询小结
《列车时刻表查询小结.doc》
将本文的Word文档下载到电脑,方便编辑。
推荐度:
点击下载文档
点击下载本文文档