求助数据搜索以后的结果进行分页出现的问题,加分马上
关于搜索以后的结果进行分页出现的问题,是一个asp和MSSQL的火车线路搜索程序,搜索条件主要是首站和末站。然后搜索户huoche这个表里面对应的数据。但是搜索的第一页数据正确,但是翻页以后的数据就不对了,应该是符合条件的数据,但是现在是显示所有数据。
搜索的动作页面。
<!--#include file="Conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<table width="590" height="502" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td colspan="2" rowspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="37" height="446"> </td>
</tr>
</table></td>
<td width="553" height="103" align="right" valign="bottom"><table width="500" height="35" border="0" cellpadding="0" cellspacing="0">
<tr align="right" valign="bottom">
<td><a href="bianmin.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','img/bianmin-1-2.gif',1)"><img src="img/bianmin-1-1.gif" name="Image1" width="99" height="35" border="0"></a></td>
<td width="115"><a href="bianmin_qiche1.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','img/bianmin-2-2.gif',1)"><img src="img/bianmin-2-1.gif" name="Image2" width="99" height="35" border="0"></a></td>
<td width="115"><a href="bianmin_huoche.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','img/bianmin-3-2.gif',1)"><img src="img/bianmin-3-1.gif" name="Image3" width="99" height="35" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="38" align="right" valign="bottom"><table width="550" height="35" border="0" cellpadding="0" cellspacing="0">
<tr align="right" valign="bottom">
<td width="198" align="left"><font color="#000000" size="4"><strong>火车车次 </strong></font><font color="#000000" size="5"> </font>
</td>
<td width="122" align="right"><a href="bianmin_hangban.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image7','','img/bianmin-4-2.gif',1)"><img src="img/bianmin-4-1.gif" name="Image7" width="99" height="35" border="0"></a></td>
<td width="115"><a href="bianmin_dianhua.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image5','','img/bianmin-5-2.gif',1)"><img src="img/bianmin-5-1.gif" name="Image5" width="99" height="35" border="0"></a></td>
<td width="115"><a href="ym/bianmin_youbian.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','img/bianmin-6-2.gif',1)"><img src="img/bianmin-6-1.gif" name="Image6" width="99" height="35" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="27" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="553" height="27"><div align="center"><font color="#ff0000"><b>淄博进站列车信息查询结果</b></font></div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="278" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="553" height="278" valign="top"><table width="100%" border="0" cellpadding="5">
<tr align="center" valign="middle" bgcolor="#3c98cf">
<td><strong><font size="3">车次</font></strong></td>
<td><strong><font size="3">站名名称</font></strong></td>
<td><strong><font size="3">火车类型</font></strong></td>
<td><strong><font size="3">进站时刻</font></strong></td>
<td><strong>出站时刻</strong></td>
<td><strong><font size="3">到站时间</font></strong></td>
</tr>
<%
dim shouzhan,mozhan,classlx
session("starttime")=request.form("starttime")
session("deptime")=request.form("deptime")
shouzhan=trim(request.form("shouzhan"))
mozhan=trim(request.form("mozhan"))
classlx=trim(request.form("classlx"))
set rs = server.createobject("adodb.recordset")
sqltext = "select * from huoche where shouzhan like '%"& shouzhan &"%' And mozhan like '%"& mozhan &"%' And classlx like '%"& classlx &"%'"
rs.open sqltext,conn,3,3
if rs.eof then
response.write "<tr>没有找到符合条件的火车车次信息,返回重新查找!</tr>"
response.end
end if
%>
<%
dim keyword
keyword=request("selecttext")
dim page
page=request("page")
PageSize = 6
i=1
rs.PageSize = PageSize
totalfilm=rs.recordcount
pgnum=rs.Pagecount
if page="" or clng(page)<1 then page=1
if clng(page) > pgnum then page=pgnum
if pgnum>0 then rs.AbsolutePage=page
if rs.eof and rs.bof then
%>
<%
else
%>
<%
count=0
do while not (rs.eof or rs.bof) and count<rs.PageSize
%>
<tr align="center" valign="middle" bgcolor="#90b7cf">
<td><strong><font color="#FFFFFF" size="3"><a href="bianmin_huoche_nr1.asp?id=<%=rs("id")%>" ><%=rs("checi")%></a></font></strong></td>
<td bgcolor="#90b7cf"><strong><font color="#FFFFFF" size="3"><%=rs("shouzhan")%>-<%=rs("mozhan")%></font></strong></td>
<td><strong><font color="#FFFFFF" size="3">
<%
set rs1=server.createobject("adodb.recordset")
sql="select * from classlx"
rs1.open sql,conn,3,3
%>
<%=rs1("classlx")%></font></strong></td>
<td><strong><font color="#FFFFFF" size="3"><%=rs("jrtime")%></font></strong></td>
<td><strong><font color="#FFFFFF" size="3"><%=rs("lktime")%></font></strong></td>
<td><strong><font color="#FFFFFF" size="3"><%=rs("shijian")%></font></strong></td>
</tr>
<%rs.movenext
count=count+1
loop
end if
%>
<%if page=1 then%>
<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image14','','img/1_2.gif',1)"><img src="img/1_1.gif" name="Image14" width="75" height="30" border="0"></a>
<% else %>
<a href="bianmin_huoche.asp?mozhan=<%=mozhan%>&page=<%=page-1%>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image141','','img/1_2.gif',1)"><img src="img/1_1.gif" name="Image141" width="75" height="30" border="0" id="Image141"></a>
<%end if%>
<%if rs.pagecount-page<1 then%>
<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image15','','img/2_2.gif',1)"><img src="img/2_1.gif" name="Image15" width="75" height="30" border="0"></a>
<% else %>
<a href="bianmin_huoche.asp?mozhan=<%=mozhan%>&page=<%=page+1%>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image151','','img/2_2.gif',1)"><img src="img/2_1.gif" name="Image151" width="75" height="30" border="0" id="Image151"></a>
<%end if%>
<tr align="center" valign="middle" bgcolor="#b0bfc8">
<td colspan="6">淄博市火车站提供最新资料 更新日期:2007-07-03</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="1"></td>
<td width="25"></td>
<td></td>
</tr>
</table>
</body>
</html>