<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*" %>
<jsp:useBean id="connDbBean" scope="application" class="classes.conn"/>
<!-- saved from url=(0049)http://www.nxsq.com/bus/buffer/busIDInfo/bus4.htm -->
<HTML><HEAD><TITLE>车次查询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>BODY {
	FONT-SIZE: 13px; FONT-FAMILY: 宋体; TEXT-ALIGN: center
}
TR {
	FONT-SIZE: 13px; FONT-FAMILY: 宋体; TEXT-ALIGN: center
}
TD {
	FONT-SIZE: 13px; FONT-FAMILY: 宋体; TEXT-ALIGN: center
}
a:link {
	color: #0000FF;
}
a:visited {
	color: #993300;
}
a:hover {
	color: #FF0000;
}
a:active {
	color: #FF0000;
}
</STYLE>

<META content="MSHTML 6.00.2900.2995" name=GENERATOR></HEAD>
<BODY>
<% Connection con;
    String statement="";
	ResultSet result;
	String Station=new String(request.getParameter("query2").getBytes("ISO8859_1"),"GBK");
	
    int count=0;
	
   String stations[]=new String[100]; //用来存放某一路线的所有站点
     
     
  	try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	     }
		catch(ClassNotFoundException e){}
		 
	try{ 
	      con=DriverManager.getConnection("jdbc:odbc:nbos","","");
	      Statement sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); 
		  statement="select * from bus where Detail LIKE '%"+Station+"%' order by Sort ASC" ;
		  
          result=sql.executeQuery(statement);
      
		  if(!result.next())
		     { 
                response.sendRedirect("errorquery2.jsp");
		     }
            else 
              { 
                result.previous();
		  %>
<TABLE cellSpacing=1 cellPadding=3 width=650 align=center 
border=0>
  <TBODY>
    <TR>
    <TD><STRONG><FONT color=#000000>站点查询结果</FONT></STRONG></TD>
  </TR>
  <TR>
    <TD><!--查询结果显示开始-->
      <TABLE width=500 height="84" border=0 cellPadding=3 cellSpacing=1 >
        <TBODY>
        <TR >
          <TD height="19" colspan="2">查询的站点名：<STRONG><font color="#000000"><%=Station%></font></STRONG></TD>
          </TR>
        <TR>
          <TD width=73 height="19">车次号</TD>
          <TD width="412">经过的所有站点</TD>
        </TR>
		<% while(result.next())
	      {   String BusID=result.getString("BusID");
		      String Detail=result.getString("Detail"); 
			 StringTokenizer str1=new StringTokenizer(Detail,"->");
			  count=0;
		    while(str1.hasMoreTokens())
		        { stations[count]=str1.nextToken();
			     count++;
			    }//endwhile
			  
			 
			   %>
       
	    <TR onmouseover="this.style.backgroundColor = '#FFF9EE'" 
        onmouseout="this.style.backgroundColor = ''"  bgColor=#e8f3ff>
          <TD height="42"><a href="resultquery1.jsp?query1=<%=BusID%>" target="_blank"><%=BusID%></a></TD>
          <TD> 
		    <div align="left">
		        <%   
		  for(int i=0;i<count;i++)
		    {  if(stations[i].indexOf(Station)!=-1)
		         {  %> 
				       <font color="#000000"><%=stations[i]%> &nbsp;</font>
		            <% }//endif
				  else  { %>
				    
   				     <font size="2"><%=stations[i]%>&nbsp;</font>
				     
			      <% 
                  }//endelse
				  }//endfor			
			  
				 
			  	
		  %>
		      </div></TD></TR>
		  <%   }//endwhile
        }//end else
		
		 result.close();}
	    catch(SQLException e1){}
		
		%>
		  
		  </TBODY></TABLE>
      <!--查询结果显示结束--><BR>       <input type=button name="close6" value="关闭窗口"
      width="78" height="21" border=0 
       onclick=window.close()> </TD>
  </TR>
  
   
  </TBODY></TABLE></BODY></HTML>
