<!--#include file="Header.asp"-->
<%
   	if sTitle="" then
 	response.Redirect "/Train/"
	end if 

Dim Rs, Sql, iData, theData, theMileage, I
	Sql = "select c1.theNum, c1.theType, c1.sTitle, c1.eTitle, c2.sTitle, c2.sTime, c3.sTitle, c3.eTime, c3.Mileage, c2.Mileage, c3.Days, c2.Days,c1.sTime from " & TablePre & "traininfo as c3 inner join (" & TablePre & "traininfo as c2 inner join " & TablePre & "trainlist as c1 on c2.theNum = c1.theNum) on c3.theNum = c1.theNum and c3.sTitle = c1.eTitle where c2.sTitle like '%" & sTitle & "%' order by c1.theNum;"
	Set Rs = Db.ExeCute(Sql)
	If Not(Rs.Eof And Rs.Bof) Then theData = Rs.getRows(-1)
	Rs.Close:Set Rs = Nothing
%>
<div id="maintable">
	<h2>
		<div class="left">您查询的是:&nbsp;<a href="./?tId=3&amp;sTitle=<%= sTitle  %>"><%= sTitle %></a>&nbsp;站的所有车次列表。</div>
		<div class="right">共有&nbsp;<b><% If IsArray(theData) Then Write Ubound(theData,2)+1 Else Write "0" %></b>&nbsp;条查询结果</div>
	</h2>
</div>
<div id="maintable">
	<div id="NavTabTop">
		<div class="left" style="width: 100px;">车次</div>
		<div class="left" style="width: 60px;">车辆类型</div>
		<div class="left" style="width: 80px;">始发站</div>
		<div class="left" style="width: 80px;">终点站</div>
		<div class="left" style="width: 80px;">发站</div>
		<div class="left" style="width: 80px;">发时</div>
		<div class="left" style="width: 80px;">到站</div>
		<div class="left" style="width: 80px;">到时</div>
		<div class="left" style="width: 60px;">里程</div>
		<div class="left" style="width: 60px;">历时</div>
	</div>
	<% If IsArray(theData) Then %>
	<% For I = 0 To Ubound(theData,2) %>
	<% theMileage =  theData(8,I)-theData(9,I)  %>
	<div id="NavTabMid" onMouseOver="this.style.background='#ffffff';" onMouseOut="this.style.background='#eff3f9';">
		<div class="left" style="width: 100px;"><a href="TrainInfo.asp?tId=2&amp;theNum=<%= theData(0,I) %>"><%= theData(0,I) %></a></div>
		<div class="left" style="width: 60px;"><%= theData(1,I) %></div>
		<div class="left" style="width: 80px;"><a href="./?tId=3&amp;sTitle=<%= theData(2,I) %>"><%= theData(2,I) %></a></div>
		<div class="left" style="width: 80px;"><a href="./?tId=3&amp;sTitle=<%= theData(3,I) %>"><%= theData(3,I) %></a></div>
		<div class="left" style="width: 80px;"><% If CStr(theMileage) = "0" Then %><a href="./?tId=3&amp;sTitle=<%= theData(2,I) %>"><%= theData(2,I) %></a><% Else %><a href="./?tId=3&amp;sTitle=<%= theData(4,I) %>"><%= theData(4,I) %></a><% End If %></div>
		<div class="left" style="width: 80px;"><% If CStr(theMileage) = "0" Then %><%= Days(1) & theData(12,I) %><% Else %><%= Days(theData(11,I)) & theData(5,I) %><% End If %></div>
		<div class="left" style="width: 80px;"><a href="./?tId=3&amp;sTitle=<%= theData(6,I) %>"><%= theData(6,I) %></a></div>
		<div class="left" style="width: 80px;"><%= Days(theData(10,I)) & theData(7,I) %></div>
		<div class="left" style="width: 60px;"><% If CStr(theMileage) = "0" Then %><%= theData(9,I) %><% Else %><%= theMileage %><% End If %></div>
		<div class="left" style="width: 60px;"><% If CStr(theMileage) = "0" Then %><%= FormatMyDate(DateDiff("n",theData(12,I),theData(7,I))+((theData(10,I)-1)*24*60)) %><% Else %><%= FormatMyDate(DateDiff("n",theData(5,I),theData(7,I))+((theData(10,I)-theData(11,I))*24*60)) %><% End If %></div>
	</div>
	<% Next %>
	<% Else %>
	<div id="NavTabMid" onMouseOver="this.style.background='#ffffff';" onMouseOut="this.style.background='#eff3f9';">
		暂无数据(请准确输入您所查询的信息)
	</div>
	<% End If %>
	<div id="NavTabBottom"></div>
</div>
<!--#include file="Footer.asp"-->
