[求助] 在一个页面中进行条件查询并
哪位前辈帮我看下这段程序:说明: 这段程序是一个简单的查询并显示结果的程序,页面上有一表单,在文本框内输入条件按查询后将结果显示在下面的表格里;底部有分页功能。
问题:为什么在填入查询条件后如果查询结果有多页的话,单击页数后原来的查询结果和查询条件都没了?
<!--#include file="con.asp" -->
<div align="center"> <p>订单明细查询</p></div>
<table width="95%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td >
<form action="pu.asp" method="post" target="_self"> 'pu.asp就是本页面
订单编号:<input size=20 name=puno>
日期:<INPUT size=20 name=date>
<input name="Submit" type="submit" value=" 筛选记录 ">
</form>
</td>
</tr>
</table>
<table width = 95% align = center cellspacing = 1 cellpadding = 2 border=1
bordercolor=#9999FF bordercolordark=#FFFFFF bordercolorlight=#E1F5FF>
<tr>
<td align=center width=42%><strong>日期</strong></td>
<td align=center width=58%><strong>订单编号</strong></td>
</tr>
<%
ccpuno = Request.form("puno")
Set rs = Server.CreateObject("ADODB.RecordSet")
IF Len(ccpuno)=0 Then
sql="Select * from pu order by date desc"
else
sql="Select * from pu where pu.puno like '%"&ccpuno&"%' order by date desc"
end if
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
response.Write "目前没有记录"
else
counts=50 '每面显示50条记录
rs.pageSize = counts
allpages = rs.pageCount
page = Request("page")
If not isNumeric(page) then page=1
if isEmpty(page) or Cint(page) < 1 then
page = 1
elseif Cint(page) >= allPages then
page = allPages
end if
rs.AbsolutePage = page
Do While (Not rs.eof) and counts>0
%>
<tr>
<td><div align="left"><span class="STYLE2"><%=rs("date")%> </span></div></td>
<td><div align="left"><span class="STYLE2"><%=rs("puno")%> </span></div></td>
</tr>
<%
counts = counts - 1
rs.movenext
if rs.eof then exit do
loop
End If
%>
</table>
<%
response.write "<br><a href='#top'>【Top】</a> 当前共有"&RS.RecordCount&"条记录 "
if page = 1 then
response.write "<font color=darkgray>首页 上一页</font>"
else
response.write "<a href=pu.asp?page=1>首页</a> <a href=pu.asp?
page="&page-1&"> 上一页</a>"
end if
if page = allpages then
response.write "<font color=darkgray> 下一页 末页</font>"
else
response.write " <a href=pu.asp?page="&page+1&">下一页</a> <a href=pu.asp?
page="&allpages&">末页</a>"
end if
response.write " 第"&page&"页/共"&allpages&"页 "
%>
[此贴子已经被作者于2007-11-5 8:24:53编辑过]