asp问题 查询时候分页显示怎么实现

<%dimhhdimeeDimipagecountDimipagecurrentDimstrorderByDimirecordsshownifrequest.querys... <%
dim hh
dim ee
Dim ipagecount
Dim ipagecurrent
Dim strorderBy
Dim irecordsshown
if request.querystring("page")="" then
ipagecurrent=1
else
ipagecurrent=cint(request.querystring("page"))
end if
rs.pagesize =4
rs.cachesize =4
ipagecount = rs.pagecount
Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='5'>"
top=1
if rs.bof and rs.eof then
response.write "<tr><td align='center'>没有任何文件</tr></td></table>"
else
cc=rs("btype")
cb=rs("fanwei")
rs.absolutepage = ipagecurrent
irecordsshown = 0
do while not rs.eof and irecordsshown<4
if not rs.eof then
ee=rs("minipic")
hh=mid(ee,instr(ee,"/")+1)
%>

分页
<%
top=top+1
irecordsshown=irecordsshown+1
rs.movenext
end if
if top>4 then exit do
loop
end if
rs.Close
set rs=nothing
Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' ><tr><td height='20' align='center' class='STYLE311'>共有 "&ipagecount&" 页 当前为第 "&ipagecurrent&" 页 "
if ipagecurrent=1 then
Response.Write"首页 | "
else
Response.Write"<a href='lanmu.asp?&page=1&cc="&cc&"&cb="&cb&"'>首页</a> | "
end if
if ipagecurrent=1 then
Response.Write"上一页 | "
else
Response.Write"<a href='lanmu.asp?page="&ipagecurrent-1&"&cc="&cc&"&cb="&cb&"'>上一页</a> | "
end if
if ipagecount>ipagecurrent then
Response.Write"<a href='lanmu.asp?page="&ipagecurrent+1&"&cc="&cc&"&cb="&cb&"'>下一页</a> "
else
Response.Write"下一页"
end if
if ipagecount>ipagecurrent then
Response.Write"| <a href='lanmu.asp?page="&ipagecount&"&cc="&cc&"&cb="&cb&"'>末页</a> "
else
Response.Write"| 末页 "
end if
Response.Write"</td></tr></table>"
%>

为什么能看到页 也能看到数据 也能看到几页 就是不能点下一页啊
显示22页
在线等
展开
 我来答
swalia
推荐于2016-05-26
知道答主
回答量:61
采纳率:0%
帮助的人:28.3万
展开全部
sql="select * from [Users] where uid like '%"&UID&"%'"
end if

rs.open sql,conn,1,2

dim MaxPerPage
MaxPerPage=16
'假如没有数据时
'If rs.eof and rs.bof then
'call showpages
'response.write "<p align='center'><font color='#ff0000'>还没任何用户订单</font></p>"
'response.end
'End if

'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next

If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if

'call showpages
call list

If Rs.recordcount > MaxPerPage then
end if

'显示帖子的子程序
Sub list()%>
<%
if not rs.eof then
i=0
do while not rs.eof
%>
<%=rs("显示的东东")%>
<%
i=i+1
if i >= MaxPerpage then exit do
rs.movenext
loop
end if
%>
'下面是分页
<%
Response.write "<strong><font color='#000000'>-> 全部-</font>"
Response.write "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>条信息</font></strong>          "
Response.write "<strong><font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font></strong> "
If currentpage > 1 Then
response.write "<strong><a href='?&page="+cstr(1)+"&vip="&request("vip")&"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font></strong>"
Response.write "<strong><a href='?page="+Cstr(currentpage-1)+"&vip="&request("vip")&"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font></strong>"
Else
Response.write "<strong><font color='#000000'>上一页 </font></strong>"
End if
If currentpage < Rs.PageCount Then
Response.write "<strong><a href='?page="+Cstr(currentPage+1)+"&vip="&request("vip")&"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='?page="+Cstr(Rs.PageCount)+"&vip="&request("vip")&"'><font color='#000000'>尾页</font></a></strong>  "
Else
Response.write ""
Response.write "<strong><font color='#000000'>下一页</font></strong>  "
End if
'response.write "</td><td align='right'>"
'response.write "<font color='#000000' >转到:</font><input type='text' name='page' size=4 maxlength=4 class=smallInput value="&Currentpage&"> "
'response.write "<input class=buttonface type='submit' value='Go' name='cndok'>  "
%>
<%
End sub
rs.close
conn.close
'end if
%>
自己稍改一下.我不知道你主要是用来分什么页面的..
suen3492
2008-02-21
知道答主
回答量:38
采纳率:0%
帮助的人:0
展开全部
<%
dim hh
dim ee
Dim ipagecount
Dim ipagecurrent
Dim strorderBy
Dim irecordsshown
if request.querystring("page")="" then
ipagecurrent=1
else
ipagecurrent=cint(request.querystring("page"))
end if
rs.pagesize =4
rs.cachesize =4
ipagecount = rs.pagecount
Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='5'>"
top=1
if rs.bof and rs.eof then
response.write "<tr><td align='center'>没有任何文件</tr></td></table>"
else
cc=rs("btype")
cb=rs("fanwei")
rs.absolutepage = ipagecurrent
irecordsshown = 0
do while not rs.eof and irecordsshown<4
if not rs.eof then
ee=rs("minipic")
hh=mid(ee,instr(ee,"/")+1)
%>

分页
<%
top=top+1
irecordsshown=irecordsshown+1
rs.movenext
end if
if top>4 then exit do
loop
end if
rs.Close
set rs=nothing
Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' ><tr><td height='20' align='center' class='STYLE311'>共有 "&ipagecount&" 页 当前为第 "&ipagecurrent&" 页 "
if ipagecurrent=1 then
Response.Write"首页 | "
else
Response.Write"<a href='lanmu.asp?&page=1&cc="&cc&"&cb="&cb&"'>首页</a> | "
end if
if ipagecurrent=1 then
Response.Write"上一页 | "
else
Response.Write"<a href='lanmu.asp?page="&ipagecurrent-1&"&cc="&cc&"&cb="&cb&"'>上一页</a> | "
end if
if ipagecount>ipagecurrent then
Response.Write"<a href='lanmu.asp?page="&ipagecurrent+1&"&cc="&cc&"&cb="&cb&"'>下一页</a> "
else
Response.Write"下一页"
end if
if ipagecount>ipagecurrent then
Response.Write"| <a href='lanmu.asp?page="&ipagecount&"&cc="&cc&"&cb="&cb&"'>末页</a> "
else
Response.Write"| 末页 "
end if
Response.Write"</td></tr></table>"
%>

为什么能看到页 也能看到数据 也能看到几页 就是不能点下一页啊
显示22页
问题补充:在线等
提问者:slswan392 - 试用期 一级
回答 共 2 条
sql="select * from [Users] where uid like '%"&UID&"%'"
end if

rs.open sql,conn,1,2

dim MaxPerPage
MaxPerPage=16
'假如没有数据时
'If rs.eof and rs.bof then
'call showpages
'response.write "<p align='center'><font color='#ff0000'>还没任何用户订单</font></p>"
'response.end
'End if

'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next

If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if

'call showpages
call list

If Rs.recordcount > MaxPerPage then
end if

'显示帖子的子程序
Sub list()%>
<%
if not rs.eof then
i=0
do while not rs.eof
%>
<%=rs("显示的东东")%>
<%
i=i+1
if i >= MaxPerpage then exit do
rs.movenext
loop
end if
%>
'下面是分页
<%
Response.write "<strong><font color='#000000'>-> 全部-</font>"
Response.write "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>条信息</font></strong> "
Response.write "<strong><font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font></strong> "
If currentpage > 1 Then
response.write "<strong><a href='?&page="+cstr(1)+"&vip="&request("vip")&"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font></strong>"
Response.write "<strong><a href='?page="+Cstr(currentpage-1)+"&vip="&request("vip")&"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font></strong>"
Else
Response.write "<strong><font color='#000000'>上一页 </font></strong>"
End if
If currentpage < Rs.PageCount Then
Response.write "<strong><a href='?page="+Cstr(currentPage+1)+"&vip="&request("vip")&"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='?page="+Cstr(Rs.PageCount)+"&vip="&request("vip")&"'><font color='#000000'>尾页</font></a></strong> "
Else
Response.write ""
Response.write "<strong><font color='#000000'>下一页</font></strong> "
End if
'response.write "</td><td align='right'>"
'response.write "<font color='#000000' >转到:</font><input type='text' name='page' size=4 maxlength=4 class=smallInput value="&Currentpage&"> "
'response.write "<input class=buttonface type='submit' value='Go' name='cndok'> "
%>
<%
End sub
rs.close
conn.close
'end if
%>
自己稍改一下.我不知道你主要是用来分什么页面的..
回答者:swalia - 试用期 一级 2-21 07:54
<%
'执行sql
set rs=server.CreateObject("adodb.recordset")%>
rs.open "select * from news order by id desc ",a,1,3

'分页
i=50
rs.pagesize=i
pu=request("pu")
if pu="" then pu=1
if cint(pu)<="0" then pu=1
if cint(pu)>rs.pagecount then pu=rs.pagecount
if not rs.eof then rs.absolutepage=cint(pu)
'显示记录
if not rs.eof then
do while not rs.eof and i=>1
response.write rs("字段")'显示字段
'就这里改你要的,其它复制用就可以
rs.movenext
i=i-1
loop
end if
%>

当前第 <%=pu%> 页;分
<%=rs.pagecount%> 页;
共 <%=rs.recordcount%> 条记录;
每页<%=i%>条记录
<a href="?pu=1">首 页</a>
<a href="?pu=<%=cint(PU)-1%>">上一页</a>
<a href="?pu=<%=cint(PU)+1%>">下一页</a>
<a href="?pu=<%=rs.pagecount%>">末 页</a>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
jianan8610
2008-02-21 · 超过55用户采纳过TA的回答
知道小有建树答主
回答量:154
采纳率:0%
帮助的人:182万
展开全部
<%
'执行sql
set rs=server.CreateObject("adodb.recordset")%>
rs.open "select * from news order by id desc ",a,1,3

'分页
i=50
rs.pagesize=i
pu=request("pu")
if pu="" then pu=1
if cint(pu)<="0" then pu=1
if cint(pu)>rs.pagecount then pu=rs.pagecount
if not rs.eof then rs.absolutepage=cint(pu)
'显示记录
if not rs.eof then
do while not rs.eof and i=>1
response.write rs("字段")'显示字段
'就这里改你要的,其它复制用就可以
rs.movenext
i=i-1
loop
end if
%>

当前第 <%=pu%> 页;分
<%=rs.pagecount%> 页;
共 <%=rs.recordcount%> 条记录;
每页<%=i%>条记录
<a href="?pu=1">首 页</a>
<a href="?pu=<%=cint(PU)-1%>">上一页</a>
<a href="?pu=<%=cint(PU)+1%>">下一页</a>
<a href="?pu=<%=rs.pagecount%>">末 页</a>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友91ae5bdb4
2008-02-25 · 超过12用户采纳过TA的回答
知道答主
回答量:52
采纳率:0%
帮助的人:0
展开全部
站长论坛
http://bbs.cnzz18.cn
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式