asp搜索分页,第一页显示正常,当翻第二页的时候,读取的数据是全部数据的第二页,求大神帮助!
<%dimchrSQLSetRs=Server.Createobject("adodb.recordset")ifID<>""thenifs_ID<>""thenchrS...
<%dim chrSQL
Set Rs = Server.Createobject("adodb.recordset")
if ID<>"" then
if s_ID<>"" then chrSQL="and f_city="&ID&" "&s_ID
elseif s_IDS<>"" then
chrSQL="and f_city="&ID&" "&s_IDS
else
chrSQL="and f_city="&ID
end if
else
if s_ID<>"" then
chrSQL=s_ID
elseif s_IDS<>"" then
chrSQL=s_IDS
else
chrSQL=""
end if
end if
Rs.Open "select * from Company where f_Bigtypeid=3 and f_ischeck=true "&chrSQL&" order by f_sun,f_id desc",Conn,1,3
if not(Rs.eof or Rs.bof) then
tatalrecord=Rs.recordcount
tatalpages=int(tatalrecord/16)+1
Rs.PageSize=16
pageCount = cint(Rs.pageCount)
Rs.movefirst
nowpage=request("page")
if nowpage&"x"="x" then
nowpage=1
else
nowpage=cint(nowpage)
end if
Rs.absolutepage=nowpage
n=1
dim exin
do while not Rs.eof and n<=16
%>
<table>
<tr>
<td><img src="<%=rs("f_logo")%>"/></td>
<td><%=rs("f_dd")%></td>
<td><%=rs("f_renjun")%></td>
</tr>
</table>
<%
n=n+1
Rs.movenext
loop
Rs.close
end if
%>
<table width="950" height="29" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<%if nowpage<>"" then %>
共 <%=tatalrecord%> 篇 16篇/页 共 <%=tatalpages%> 页</font> ;
<%response.write csPage(nowpage,tatalpages,"?action="&searchs&"&ID="&ID&"&page=")%>
<%end if%>
</td></tr></table> 展开
Set Rs = Server.Createobject("adodb.recordset")
if ID<>"" then
if s_ID<>"" then chrSQL="and f_city="&ID&" "&s_ID
elseif s_IDS<>"" then
chrSQL="and f_city="&ID&" "&s_IDS
else
chrSQL="and f_city="&ID
end if
else
if s_ID<>"" then
chrSQL=s_ID
elseif s_IDS<>"" then
chrSQL=s_IDS
else
chrSQL=""
end if
end if
Rs.Open "select * from Company where f_Bigtypeid=3 and f_ischeck=true "&chrSQL&" order by f_sun,f_id desc",Conn,1,3
if not(Rs.eof or Rs.bof) then
tatalrecord=Rs.recordcount
tatalpages=int(tatalrecord/16)+1
Rs.PageSize=16
pageCount = cint(Rs.pageCount)
Rs.movefirst
nowpage=request("page")
if nowpage&"x"="x" then
nowpage=1
else
nowpage=cint(nowpage)
end if
Rs.absolutepage=nowpage
n=1
dim exin
do while not Rs.eof and n<=16
%>
<table>
<tr>
<td><img src="<%=rs("f_logo")%>"/></td>
<td><%=rs("f_dd")%></td>
<td><%=rs("f_renjun")%></td>
</tr>
</table>
<%
n=n+1
Rs.movenext
loop
Rs.close
end if
%>
<table width="950" height="29" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<%if nowpage<>"" then %>
共 <%=tatalrecord%> 篇 16篇/页 共 <%=tatalpages%> 页</font> ;
<%response.write csPage(nowpage,tatalpages,"?action="&searchs&"&ID="&ID&"&page=")%>
<%end if%>
</td></tr></table> 展开
展开全部
<%response.write csPage(nowpage,tatalpages,"?action="&searchs&"&ID="&ID&"&page=")%>page的参数没传进来哎???
<%response.write csPage(nowpage,tatalpages,"?action="&searchs&"&ID="&ID&"&page="&nowpage'吧当前页面传入)%>
还有16也要判断下吧,
if nowpage = pagecount then
nowcount = tatalrecord - (pagecount - 1)*16 '记录末页的条数
else
nowcount = 16
end if
话说total也拼错了。。。。。。还有Rs.movefirst不需要这句话吧,还有也不需要技术totalpages吧,pagecount不就是最大页数????
<%response.write csPage(nowpage,tatalpages,"?action="&searchs&"&ID="&ID&"&page="&nowpage'吧当前页面传入)%>
还有16也要判断下吧,
if nowpage = pagecount then
nowcount = tatalrecord - (pagecount - 1)*16 '记录末页的条数
else
nowcount = 16
end if
话说total也拼错了。。。。。。还有Rs.movefirst不需要这句话吧,还有也不需要技术totalpages吧,pagecount不就是最大页数????
更多追问追答
追问
麻烦你把完整的代码写一遍呢!!!谢谢!
追答
if not(Rs.eof or Rs.bof) then
tatalrecord=Rs.recordcount
tatalpages=int(tatalrecord/16)+1 ‘想说这个也不要,但是你下面都是使用这个变量,所以维持原样吧
Rs.PageSize=16
pageCount = cint(Rs.pageCount)
'Rs.movefirst '注释掉不要了
nowpage=request("page")
if nowpage&"x"="x" then
nowpage=1
else
nowpage=cint(nowpage)
end if
Rs.absolutepage=nowpage
n=1
if nowpage = pagecount then
nowcount = tatalrecord - (pagecount - 1)*16 '记录末页的条数
else
nowcount = 16
end if
dim exin
do while not Rs.eof and n最底部这边的page参数传值进去看看~~~,,你这个函数有带page但是没有吧page参数值传入,估计就是这个影响了,你先改看看~~~
展开全部
Rs.movefirst把这句去掉!
更多追问追答
追问
还是不得行,一样的结果
追答
if nowpage&"x"="x" then
nowpage=1
else
nowpage=cint(nowpage)
end if
首先在页首加上 on error resume next
然后
这个判断改成
thepage=clng(nowpage)
if isnumerice(thepage) and (thepage=0 or thepage=1) then
nowpage=1
elseif isnumerice(thepage) then
nowpage=clng(nowpage)
end if
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询