怎样在各个页面显示10个记录?

janlon 2002-02-21 05:37:21
我有一个分页页面,想在第一个页面显示前10个记录,第二个页面显示第11~20记录,第三个页面显示第21~30个记录,依此类推!
请问我怎样才可以实现这种功能?
...全文
136 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
janlon 2002-02-22
  • 打赏
  • 举报
回复
还是发给我吧!我下载不了,不知是不是地址错了!
我的邮箱:ekong@163.net
janlon 2002-02-22
  • 打赏
  • 举报
回复
问题一解决,马上给你加分!
haplake 2002-02-22
  • 打赏
  • 举报
回复
你给我加分,我就告诉你代码
janlon 2002-02-22
  • 打赏
  • 举报
回复
不一样啊!这里是一行显示两个记录...
janlon 2002-02-22
  • 打赏
  • 举报
回复
我想一行显示两个记录,每页显示10个记录,这样的代码有没有人有啊?或者应怎么写啊?
ludy 2002-02-22
  • 打赏
  • 举报
回复
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
call showpages
end if

'显示帖子的子程序
Sub list()%>

If currentpage > 1 Then
response.write "<a href='ybcx_user.asp?&page="+cstr(1)+"'><font color='#000000'>首页</font></a><font color='#ffffff'><b>-</b></font>"
Response.write "<a href='ybcx_user.asp?page="+Cstr(currentpage-1)+"'><font color='#000000'>前页</font></a><font color='#ffffff'><b>-</b></font>"
Else
Response.write "<font color='#000000'>首页-</font>"
Response.write "<font color='#000000'>上页-</font>"
End if

If currentpage < Rs.PageCount Then
Response.write "<a href='ybcx_user.asp?page="+Cstr(currentPage+1)+"'><font color='#000000'>后页</font></a><font color='#ffffff'><b>-</b></font>"
Response.write "<a href='ybcx_user.asp?page="+Cstr(Rs.PageCount)+"'><font color='#000000'>尾页</font></a>  "
Else
Response.write "<font color='#000000'>下页-</font>"
Response.write "<font color='#000000'>末页</font>  "
End if
Response.write "<font color='#000000'>页次:</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font> "
Response.write "<font color=#ff0000>" & Cstr(MaxPerPage) & "</font>" & "<font color='#000000'>位用户/页 " & "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>位用户</font>  "

response.write "</td><td align='right'>"
response.write "<font color='#000000' >转到:</font><input type='text' name='page' size=4 maxlength=4 value="¤tpage&"> "
response.write "<input type='submit' value='Go' name='cndok' ></span>  "
%>
ttt2 2002-02-22
  • 打赏
  • 举报
回复
rs.absolutepage
rs.pagesize
希偌 2002-02-21
  • 打赏
  • 举报
回复
是的,你下载自己体会,这个是服务器端为vbscript脚本的例子!
我还有一个同样功能,是用javascript作为服务器端脚本写的,要的话说一声!
ssm1226 2002-02-21
  • 打赏
  • 举报
回复
不管是不是,分页这玩意,每人必备,很多地方都有的
janlon 2002-02-21
  • 打赏
  • 举报
回复
TO:beyond_xiruo(希偌)
ekong@163.net
上面那个是你所说的那一个吗?
希偌 2002-02-21
  • 打赏
  • 举报
回复
http://home.pchome.com.tw/mysite/33360247/select.zip
这个是例子的下载地址,自己体会吧!
xingyu6688 2002-02-21
  • 打赏
  • 举报
回复
我有一个!!要给分
看下边!

<%
if Request.Form("P")="1" then
c_num=trim(request("c_num"))
c_china_name=trim(request("c_china_name"))
c_english_name = trim(request("c_english_name"))
c_telephone = trim(request("c_telephone"))
c_fax_num = trim(request("c_fax_num"))
c_contact_people = trim(request("c_contact_people"))
c_num_s= trim(request("c_num_s"))
c_china_name_s= trim(request("c_china_name_s"))
c_english_name_s= trim(request("c_english_name_s"))
c_telephone_s = trim(request("c_telephone_s"))
c_fax_num_s = trim(request("c_fax_num_s"))
c_contact_people_s = trim(request("c_contact_people_s"))

if c_num="" and c_china_name="" and c_english_name="" and c_telephone="" and c_fax_num="" and c_contact_people ="" then

session("sql")="select * from carman order by ccode"

elseif c_num<>"" then
if c_num_s="匹配" then
session("sql")="select * from carman where ccode='"&c_num&"' order by ccode"
else
session("sql")="select * from carman where ccode like '%"&c_num&"%' order by ccode"
end if
elseif c_china_name<>"" then
if c_china_name_s="匹配" then
session("sql")="select * from carman where name='"&c_china_name&"' order by ccode"
else
session("sql")="select * from carman where name like '%"&c_china_name&"%' order by ccode"
end if
elseif c_english_name<>"" then
if c_english_name_s="匹配" then
session("sql")="select * from carman where ename='"&c_english_name&"' order by ccode"
else
session("sql")="select * from carman where ename like '%"&c_english_name&"%' order by ccode"
end if
elseif c_telephone<>"" then
if c_telephone_s="匹配" then
session("sql")="select * from carman where tel='"&c_telephone&"' order by ccode"
else
session("sql")="select * from carman where tel like '%"&c_telephone&"%' order by ccode"
end if
elseif c_fax_num<>"" then
if c_fax_num_s="匹配" then
session("sql")="select * from carman where fax='"&c_fax_num&"' order by ccode"
else
session("sql")="select * from carman where fax like '%"&c_fax_num&"%' order by ccode"
end if
elseif c_contact_people<>"" then
if c_contact_people_s="匹配" then
session("sql")="select * from carman where contact='"&c_contact_people&"' order by ccode"
else
session("sql")="select * from carman where contact like '%"&c_contact_people&"%' order by ccode"
end if
end if
end if
%>
<!--#include file="../htm/menu.htm"-->
<!--#include file="../connect/connection.asp"-->
<script language=javascript src="../css/js.js"></script>
<html>
。。。。。
<form Name="nation" action="" method="post">
。。。。。
<%
dim rs
dim sql
msg_per_page = 10 '每页条数'
set rs=server.createObject("adodb.recordset")
rs.cursorlocation = 3
rs.pagesize = msg_per_page
rs.open session("sql"),cn,3,3

if rs.RecordCount=0 then
%>

<%else%>
<%
i=0
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then
totalrec = RS.RecordCount
if rs.recordcount mod msg_per_page = 0 then
n = rs.recordcount\msg_per_page
else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page")
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage
rowcount = rs.pagesize
dim i
dim k
%>
<%
if currentpage=1 then
m=1
else
m=(currentpage-1)*msg_per_page+1
end if
%>
<%end if%>
。。。。。
'写要显示的数据,'

<%
m=m+1
rowcount=rowcount-1
rs.MoveNext
loop
end if
end if

rs.close
set rs=nothing
%>
</table>


<input style="border-style: groove" type="hidden" Name="total_record" value=<%=i%>>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<%call listPages()%>
</td>
</tr>
</table>

</form>
<%
sub listPages()
if n <= 1 then exit sub
%>
<table border="1" cellspacing="0" cellpadding="0" align="center" bgcolor="d5e4f5" width="100%" bordercolorlight="#FF9933" bordercolordark="#FFFFFF">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" align="center" >
<tr>
<td>
<font class="p1">
总记录数【<%=totalrec%>】条 
当前第【<%=currentpage%>】页 
共【<%=n%>】页 
【<%=msg_per_page%>】条记录/页
</font>
</td>
<td width="3%"> </td>
<td >
<div align="right">
<%if currentpage = 1 then%>
<img src="../../background/firs_button1.gif" align="absmiddle" border="0"><img src="../../background/prev_button1.gif" align="absmiddle" border="0">
<%else%>
<a href="<%=request.ServerVariables("script_name")%>?page=1"><img src="../../background/firs_button.gif" align="absmiddle" border="0"></a><a href="<%=request.ServerVariables("script_name")%>?page=<%=currentpage-1%>"><img src="../../background/prev_button.gif" align="absmiddle" border="0"></a>
<%end if%>
<%if currentpage = n then%>
<img src="../../background/next_button1.gif" align="absmiddle" border="0"><img src="../../background/last_button1.gif" align="absmiddle" border="0">
<%else%>
<a href="<%=request.ServerVariables("script_name")%>?page=<%=currentpage+1%>"><img src="../../background/next_button.gif" align="absmiddle" border="0"></a><a href="<%=request.ServerVariables("script_name")%>?page=<%=n%>"><img src="../../background/last_button.gif" align="absmiddle" border="0"></a>
<%end if%>
<input type="text" name="go" value="<%=currentpage%>" style="border:1px solid rgb(200,200,200)" maxlength="8" size="8" onSubmit="return location.href='search_carowner_materials_return.asp?page='+document.all('go').value">
<input type="button" name="no" style="HEIGHT: 21px; WIDTH: 35px" value="查看" class="p2" Onclick="return location.href='search_carowner_materials_return.asp?page='+document.all('go').value">
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<%end sub%>
希偌 2002-02-21
  • 打赏
  • 举报
回复
给个邮箱地址,我给个我写的程序给你参考!`

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧