搜索分页问题
当我点击查询时,第一页可以显示出来,但是第二页就没有数据了,看了很多文章说是参数丢失,可我把参数加上还是不行。下面是源码<% Option Explicit %>
<!--#include file="../config/conn.asp"-->
<%
on error resume next
if session("login")<>"yes" then
response.write "<script language=JavaScript> alert('您未登陆或登陆超时,请重登陆!');window.location.href = '../login.asp' </script>"
response.end
end if
if request.QueryString("c")="" then session("fenl")="0"
if request.QueryString("c")<>"" then session("fenl")=request.QueryString("c")
dim rst,sql,curpage,i,rst1,sql1,zonge,c,startdate,enddate
set rst1=server.createobject("adodb.recordset")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>销售查询</title>
<link href="../style.css" rel="stylesheet" type="text/css">
<script language="javascript">
function checkForm(obj)
{
if(obj.startdate.value.length==0)
{
alert("请输入查询起始日期")
obj.startdate.focus()
return false
}
if(obj.enddate.value.length==0)
{
alert("请输入查询结束日期")
obj.enddate.focus()
return false
}
}
</script>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<body>
<table width="100%" height="292" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="27" valign="top"> </td>
</tr>
<tr>
<td height="140" valign="top"><table width="96%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="#9CA6C6" bordercolordark="#CCE3FF">
<tr bgcolor="#FF9933">
<td height="15" colspan="7" nowrap class="word_white"> 当前位置:销售查询>销售查询>>></td>
</tr >
<form name="form2" method="post" action="chaxun.asp?act=shijian" onSubmit="return checkForm(this)">
<tr bgcolor="#CCE3FF">
<td colspan="2">请输入要查询的时间段:</td>
<td colspan="5">
<input type="text" name="startdate" value="<%=year(date)&"-1-1"%>"> 至 <input type="text" name="enddate"value="<%=year(date)&"-1-31"%>">
选择商品分类:
<select name="fenlei" id="fenlei">
<option value="0" selected>全部</option>
<%
sql1="select f_id,f_name from [fenlei]"
rst1.open sql1,conn,1,1
do while not rst1.eof
%>
<option value="<%=rst1("f_id")%>" <% if cint(session("fenl"))=rst1("f_id") then
response.Write(" selected")
end if
%>><%=rst1("f_name")%></option>
<%
rst1.movenext
loop
rst1.close
%>
</select>
<input type="submit" name="Submit" value="确定" />
<span class="STYLE1"> *日期格式:2000-1-1</span></td>
</tr>
</form>
<%
if request.QueryString("act")="shijian" then
zonge=0
startdate=request.Form("startdate")
enddate=request.Form("enddate")
set rst=server.createobject("adodb.recordset")
sql="select x_bid,x_name,x_upid,x_num,x_price,x_sname,x_time,f_name,f_id from [xiaoshou],[fenlei] where x_date<='"&enddate&"'and x_date>='"& startdate &"'and x_upid=f_id"
if request.Form("fenlei")<>0 then
sql=sql&" and x_upid="&request.Form("fenlei")
end if
sql=sql & " order by x_id desc"
rst.open sql,conn,1,1
if rst.eof and rst.bof then
%>
<%response.write "<script language=JavaScript>alert('您查询的结果不存在或者已删除!');history.back()</script>"%>
<%else%>
<tr bgcolor="#CCE3FF">
<%
do while not rst.eof
zonge=zonge+rst("x_price")
rst.movenext
loop
%>
<td height="20" colspan="7" align="right">
销售总额 :<%=zonge%>元</td>
</tr>
<tr bgcolor="#CCE3FF">
<td width="9%" height="20" align="center" class="word_yellow">商品编号</td>
<td width="8%" align="center" class="word_yellow">商品分类</td>
<td width="13%" align="center" class="word_yellow">商品名称</td>
<td width="9%" align="center" class="word_yellow">销售数量</td>
<td width="11%" align="center" class="word_yellow">销售金额</td>
<td width="14%" align="center" class="word_yellow">收款员</td>
<td width="36%" align="center" class="word_yellow">销售时间</td>
</tr>
<%
rst.pagesize=20
curpage=Request.QueryString("curpage")
if curpage="" then curpage=1
rst.absolutepage=curpage
for i= 1 to rst.pagesize
if rst.eof then
exit for
end if
%>
<tr bgcolor="#CCE3FF">
<td align="center"><%=rst("x_bid")%></td>
<td align="center"><%=rst("f_name")%></td>
<td align="center"><%=rst("x_name")%></td>
<td align="center"><%=rst("x_num")%></td>
<td align="center"><%=rst("x_price")%></td>
<td align="center"><%=rst("x_sname")%></td>
<td align="center"><%=rst("x_time")%></td>
</tr>
<%
rst.movenext
next
%>
<tr bgcolor="#CCE3FF">
<td colspan="7" >当前第<%=curpage%>页,共有<%=rst.pagecount%>页,共有:<%=rst.recordcount%>条记录
<%if curpage=1 then%>
首页
<%else%>
<a href="?act=shijian&curpage=1">首页</a>
<%end if%>
<%if curpage=1 then%>
上一页
<%else%>
<a href="?act=shijian&curpage=<%=curpage-1%>">上一页</a>
<%end if%>
<%if rst.pagecount<curpage+1 then%>
下一页
<%else%>
<a href="?act=<%=request.QueryString("act")%>&curpage=<%=curpage+1%>&startdate=<%=startdate%>&enddate=<%=enddate%>">下一页</a>
'这里已经把搜索的参数加上了
<%end if%>
<%if rst.pagecount<curpage+1 then%>
尾页
<%else%>
<a href="?act=shijian&curpage=<%=rst.pagecount%>">尾页</a>
<%end if%> </td>
</tr>
</table>
</tr>
<%end if%>
<%end if%>
</table>
<!--#include file="../Bottom.asp"-->
<%
rst.close
set rst=nothing
set rst1=nothing
conn.close
set conn=nothing
%>
</body>
</html>
有的人说是用get方式,可我用了以后直接显示不出来数据