⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asp

📁 这是我个公交查询系统,用ASP+SQL做的,经过多次调试了 能够很好运行.
💻 ASP
字号:
<!--#include file="conn.asp"-->
<%  
    lx=request("lx")
    zd=trim(request("zd"))
	zd1=request("zd1")
	zd2=request("zd2")
	action=request("action")
%>
<title>九江公交查询</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
a:link {
	color: #FFCC00;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #FFCC00;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
	color: #FF0000;
}
.STYLE2 {
	color: #0099FF;
	font-weight: bold;
	font-size: 18px;
}
.STYLE5 {font-size: 14px}
#Layer1 {
	position:relative;
	left:340px;
	top:43px;
	width:54px;
	height:22px;
	z-index:1;
}
-->
</style>
</head>
<body>

<table width="750" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr><td height="60" align="center" valign="bottom" style="background-color:#6699FF; color:#FFCC66; font-size:40px; font-family:'华文隶书'; b"><div align="left">九江公交查询系统</div>
    <div id="Layer1"><a href="admin/admin.asp" target="_self"><span style="font-size:16px; color:#6699FF">进入后台管理</span></a></div></td>
  </tr>
  <tr>
    <td height="483"><br><br><form name="form1" method="post" action="index.asp?action=oklx">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="16%"><div align="center">路线查询</div></td>
          <td width="64%"><label>
            <input type="text" name="lx" size="15">
          例如: <span class="STYLE1">101路</span> </label></td>
          <td width="20%"><label>
            <input type="submit" name="Submit" value="提交">
          </label></td>
        </tr>
      </table>
    </form>
      <form name="form2" method="post" action="index.asp?action=okzd">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="16%"><div align="center">站点查询</div></td>
            <td width="64%"><label>
              <input type="text" name="zd" size="15">
            例如: <span class="STYLE1">火车站</span></label></td>
            <td width="20%"><label>
              <input type="submit" name="Submit2" value="提交">
            </label></td>
          </tr>
        </table>
      </form>
      <form name="form3" method="post" action="index.asp?action=okdd">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="16%" height="21"><div align="center">
              <% 
	   Set czdrs1=Server.CreateObject("ADODB.RecordSet") 
	    czdsql = "select distinct zhand from zhand order by zhand"
        czdrs1.open czdsql,conn,1,1
		if czdrs1.eof and czdrs1.bof then
			response.write "未连接上数据库"
		else
		%>
              点对点查询</div></td>
            <td width="64%"><select name="zd1"  size="1">
                <option selected value="">选择站点</option>
                <%
		
		    do while not czdrs1.eof
			%>
                <option value="<%=czdrs1("zhand")%>"><%=czdrs1("zhand")%></option>
                <%
		        czdrs1.movenext
    	    loop
		end if
        czdrs1.close
		set czdrs1=nothing	%>
              </select>
 <% 
	   Set czdrs2=Server.CreateObject("ADODB.RecordSet") 
	    czdsq2 = "select distinct zhand from zhand order by zhand"
        czdrs2.open czdsq2,conn,1,1
		if czdrs2.eof and czdrs2.bof then
			response.write "请先连接好!"
		else
		%>
              <select name="zd2"  size="1">
                <option selected value="">选择站点</option>
                <%
		
		    do while not czdrs2.eof
			%>
                <option value="<%=czdrs2("zhand")%>"><%=czdrs2("zhand")%></option>
                <%
		        czdrs2.movenext
    	    loop
		end if
        czdrs2.close
		set czdrs1=nothing	%>
              </select>            </td>
            <td width="20%"><label>
              <input type="submit" name="Submit3" value="提交">
            </label></td>
          </tr>
        </table>
      </form>
	  <table cellpadding="5" cellspacing="20">
	  <tr>
	  <td>
	  <% if action="okzd" then 
	  	if zd="" then
   response.write "<script>alert('请输入你要查询的站点');history.back();</script>"
   else
   end if
      Set rs1=Server.CreateObject("ADODB.RecordSet")
	  sq="select distinct luxian from jj where zhand Like '%"&zd&"%'  "
	  rs1.Open sq,conn,1,1
	  %>
	<%if not Rs1.eof then
do while not rs1.eof
lx1=trim(rs1("luxian"))
set rsall=server.CreateObject("adodb.recordset")
sqlall="select allzhand from lx where luxian='"&lx1&"'"
rsall.open sqlall,conn,1,1
allzhandian=rsall(0)
rsall.close
set rsall=nothing
%>
<br><br><span class="STYLE2"><%=rs1("luxian")%> 共有 <%=allzhandian%> 站 :</span>
<br>
<% set rs=Server.CreateObject("ADODB.RecordSet")
sql="select zhand,leixing  from jj where luxian='"&lx1&"'"
rs.Open sql,conn,1,1
%>
<%if not Rs.eof then
do while not rs.eof
leixing=rs("leixing")
%>
<%if leixing="下行        "then%>
<br><br><%=rs("leixing")%>: <% if trim(rs("zhand"))=zd then%><font color="#FF0000"><%=rs("zhand")%></font> &nbsp;&nbsp;<%else%>
<% if trim(rs("zhand"))=zd then%>
<font color="#FF0000"><%=rs("zhand")%></font> &nbsp;&nbsp;<%else%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><%=rs("zhand")%></a> &nbsp;&nbsp;<%end if%><%end if%>
<%elseif leixing="上行        "or leixing="环形        " then %>
<%=rs("leixing")%>: <% if trim(rs("zhand"))=zd then%><font color="#FF0000"><%=rs("zhand")%></font> &nbsp;&nbsp;<%else%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><%=rs("zhand")%></a> &nbsp;&nbsp;<%end if%>
<%else%>
<% if trim(rs("zhand"))=zd then%><font color="#FF0000"><%=rs("zhand")%></font>&nbsp;&nbsp;<%else%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><%=rs("zhand")%></a> &nbsp;&nbsp;<%end if%>
<%end if%>
<% 
rs.movenext 
loop 
else%>
<BR>
<%
end if 
rs.close
set rs=nothing%>
<%rs1.movenext 
loop 
else%>
<BR>
<%rs1.close
set rs1=nothing
end if
end if
%>
<% if action="oklx" then 
if lx="" then
   response.write "<script>alert('请输入你要查询的路线');history.back();</script>"
   else
   end if
      Set rs1=Server.CreateObject("ADODB.RecordSet")
	  sq="select luxian from lx where luxian Like '%"&lx&"%'  "
	  rs1.Open sq,conn,1,1
	  %>
	<%if not Rs1.eof then
do while not rs1.eof
lx1=trim(rs1("luxian"))
set rsall=server.CreateObject("adodb.recordset")
sqlall="select allzhand from lx where luxian='"&lx1&"'"
rsall.open sqlall,conn,1,1
allzhandian=rsall(0)
rsall.close
set rsall=nothing
%>
<br><br><span class="STYLE2"><%=rs1("luxian")%> 共有 <%=allzhandian%> 站:</span>
<br>
<% set rs=Server.CreateObject("ADODB.RecordSet")
sql="select zhand,leixing  from jj where luxian='"&lx1&"'"
rs.Open sql,conn,1,1
%>
<%if not Rs.eof then
do while not rs.eof
leixing=rs("leixing")
%>
<%if leixing="下行        "then%>
<br><br><%=rs("leixing")%>: <% if trim(rs("zhand"))=zd then%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><font color="#FF0000"><%=rs("zhand")%></font></a> &nbsp;&nbsp;<%else%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><%=rs("zhand")%></a> &nbsp;&nbsp;<%end if%>
<%elseif leixing="上行        "or leixing="环形        "OR leixing="上下        " then %>
<BR><%=rs("leixing")%>: <% if trim(rs("zhand"))=zd then%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><font color="#FF0000"><%=rs("zhand")%></font></a> &nbsp;&nbsp;<%else%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><%=rs("zhand")%></a> &nbsp;&nbsp;<%end if%>
<%else%>
<% if trim(rs("zhand"))=zd then%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><font color="#FF0000"><%=rs("zhand")%></font></a> &nbsp;&nbsp;<%else%><a href="index.asp?action=okzd&zd=<%=rs("zhand")%>" " target="_self"><%=rs("zhand")%></a> &nbsp;&nbsp;<%end if%>
<%end if%>
<% 
rs.movenext 
loop 
else%>
<BR>
<%
end if 
rs.close
set rs=nothing%>
<%rs1.movenext 
loop 
else%>
<BR>
<%rs1.close
set rs1=nothing
end if
end if
%> </td>
  </tr>
 </table>
      <% if action="okdd" then %>
      <table width="100%" align="center" cellpadding="2" cellspacing="5">
	  <tr>
	  	 <% if zd1=""or zd2="" then
   response.write "<script>alert('请选择站点');history.back();</script>"
elseif zd1=zd2 then
  response.write "<script>alert('请选择两个不同的站点');history.back();</script>"
  else
 Set zdrs1=Server.CreateObject("ADODB.RecordSet") 
		zdsql ="select distinct a.luxian,b.luxian from (select  zhand,luxian,shunx from jj where luxian in (select distinct luxian from jj where zhand in (select zhand from zhand where zhand like '%"&zd1&"%'))) a,(select  zhand,luxian,shunx from jj where luxian in (select distinct luxian from jj where zhand in (select zhand from zhand where zhand like '%"&zd2&"%'))) b where a.zhand=b.zhand order by a.luxian,b.luxian asc"
   zdrs1.open zdsql,conn,1,1
	if not zdrs1.eof then
do while not zdrs1.eof
%>
<%if zdrs1(0)=zdrs1(1) then 
luxiana=trim(zdrs1(0))%>
 <script language='javascript'> alert(" 可以直接到<%=luxiana%>") </script>
<%
else 
end if
%>
<%  Set leixrs=Server.CreateObject("ADODB.RecordSet")
leixsql="select leixing from lx where luxian='"&zdrs1(0)&"'"
leixrs.open leixsql,conn,1,1
leixing=leixrs(0)
leixrs.close
set leixrs=nothing
Set shunxrs=Server.CreateObject("ADODB.RecordSet")
if leixing="环形" then
   shunxsql="select min(shunx)as id from jj where luxian='"&zdrs1(0)&"'and zhand like '%"&zd1&"%'"
   else
   shunxsql="select max(shunx)as id from jj where luxian='"&zdrs1(0)&"'and zhand like '%"&zd1&"%'"
   end if
   shunxrs.open shunxsql,conn,1,1%>
   <%
 Set outrs=Server.CreateObject("ADODB.RecordSet") 
  outsql ="select distinct a.zhand,a.shunx from (select zhand,luxian,shunx from jj where luxian='"&zdrs1(0)&"') a,(select zhand,luxian,shunx from jj where luxian='"&zdrs1(1)&"') b where a.zhand=b.zhand and a.shunx>"&shunxrs(0)&" order by a.shunx"
    'outsql ="select distinct a.zhand,a.luxian,b.luxian from (select zhand,luxian,shunx from jj where luxian='"&zdrs1(0)&"') a,(select zhand,luxian,shunx from jj where luxian='"&zdrs1(1)&"') b where a.zhand=b.zhand and a.shunx>"&shunxrs(0)&""
        outrs.open outsql,conn,1,1%>

<td colspan="5"><div align="center"><%=zdrs1(0)%>(<%=zd1%>)转<%=zdrs1(1)%>(<%=zd2%>)</div></td> </tr><tr>
<td bgcolor=#336600><a href="index.asp?action=okzd&zd=<%=zd1%>" " target="_self">
  <div align="center"><%=zd1%></div>
</a></td>		
<%i=0
if not outrs.eof then
do while not outrs.eof
i=i+1 
%>
<%if i=4 then
i=5%>
<%else%>
<% end if%>
<%if i mod 5=0 then%>
<td ><a href="index.asp?action=okzd&zd=<%=outrs(0)%>" " target="_self"><span class="STYLE5"><%=outrs(0)%></span></a></td>
</tr><tr>
<% else%>
<td ><a href="index.asp?action=okzd&zd=<%=outrs(0)%>" " target="_self"><span class="STYLE5"><%=outrs(0)%></span></a></td>
<% end if%>
<%
outrs.movenext 
loop 
else %>
<%
Set outrs1=Server.CreateObject("ADODB.RecordSet") 
outsql1 ="select distinct a.zhand,a.shunx from (select zhand,luxian,shunx from jj where luxian='"&zdrs1(0)&"') a,(select zhand,luxian,shunx from jj where luxian='"&zdrs1(1)&"') b where a.zhand=b.zhand and a.shunx<"&shunxrs(0)&"order by a.shunx"
outrs1.open outsql1,conn,1,1%>
<%if not outrs1.eof then
do while not outrs1.eof
i=i+1 
%>
<%if i=4 then
i=5%>
<%else%>
<% end if%>
<%if i mod 5=0 then%>
<td ><a href="index.asp?action=okzd&zd=<%=outrs1(0)%>" " target="_self"><span class="STYLE5"><%=outrs1(0)%></span></a></td>
</tr><tr>
<% else%>
<td  ><a href="index.asp?action=okzd&zd=<%=outrs1(0)%>" " target="_self"><span class="STYLE5"><%=outrs1(0)%></span></a></td>
<% end if%>
<%
outrs1.movenext 
loop 
else
end if
outrs1.close
set outrs1=nothing %>
<%
end if 
shunxrs.close 
set shunxrs=nothing
outrs.close 
set outrs=nothing
%>
<td bgcolor="#B05800"><a href="index.asp?action=okzd&zd=<%=zd2%>" " target="_self">
  <div align="center"><%=zd2%></div></a></td>
</tr><tr>
 <% 
zdrs1.movenext 
loop 
else 
response.write "<script>alert('转一次车到达不了,打的发的来!!');history.back();</script>"
end if 
zdrs1.close 
set zdrs1=nothing
end if
%>
	
	     
</tr>
</table>
 <% end if
 conn.close 
set conn=nothing %>    </td>
  </tr>
</table>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -