吊牌英文怎么说:asp如何让他分页显示?.每页显示10行

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/13 05:41:36
<body><%
set conn=server.createobject("adodb.connection")

conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("net.mdb")
%>

<%
exec="select * from new order by id desc"

set rs=server.createobject("adodb.recordset")
rs.PageSize=3
rs.open exec,conn,1,1

%>

<table width="600" border="0" cellspacing="0" cellpadding="0">
<%do while not rs.eof%><tr>
</tr>
<table width="333"
border="0" align="center" cellpadding="0" cellspacing="0"
background="images/newsbj.jpg">
<tbody>
<tr>
<td width="13%" height="27"> </td>
<td width="55%" >
<a href="xinwen.asp?id=<%=rs("id")%>" name="<% if len(trim(rs("name")))>3 then
response.write left(trim(rs("name")),3)&".."
else
response.write trim(rs("name"))
end if%>\" target=\"_blank\">
<% if len(trim(rs("name")))>9 then
response.write left(trim(rs("name")),9)&".."
else
response.write trim(rs("name"))
end if%></td>
<td width="32%"><%=rs("time")%></td>
<%
rs.movenext
loop
%>
</tr>
</tbody>
希望高手直接将改好程序回答.谢了.我的这个是最简单的.希望高手告诉在哪里修改或添加.别随便粘贴一些代码.头痛着呢.数据库是ACCESS的.用ASP怎么改就OK了.多谢撒

直接改好就算了
下面给你贴段分页的代码你参考一下
这个是我刚写的一个系统的管理后台的分页显示管理
自己研究才有进步

说明 注意那个PAGE是分页的页码
conn.asp是一个数据库连接文件
<!--#include file="conn.asp"-->

<%
Page=Request.QueryString("Page")
if Int(Page)="" or int(page)<1 then
currentPage=1
else
currentPage=cint(Page)
end if
set rs=server.createobject("adodb.recordset")
sql="select * from tbl_article order by exacttime desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
rseof=1
else
rseof=2
MaxPerPage=23
PageUrl="admin_art_mnr.asp"
totalPut=rs.recordcount
if currentpage<1 then currentpage=1
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
end if
%>

<%
sub showContent
i=0

%>

<%
do while not rs.eof
%>
<tr>
<td width="30" align="center" class="table00"><%=rs("id")%></td>
<td width="340" align="center" class="table00"><a href="../showarticle.asp?id=<%=rs("id")%>" target="_blank"><% if len(rs("title"))<26 then %><%=rs("title")%><%else%><%=left(rs("title"),25)&"..."%><%end if%></a></td>
<td width="99" align="center" class="table00"><%=rs("username")%></td>
<td width="80" align="center" class="table00"><%=rs("time")%></td>
<td width="100" align="center" class="table00"><a href="article_edit.asp?id=<%=rs("id")%>" class="STYLE3">编</a>|<a href="article_del.asp?id=<%=rs("id")%>"><span class="STYLE4">删</span></a>|?</td>
</tr>

<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
end sub

function showpage(totalnumber,maxperpage,filename)
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
%>
<div align="right">共<font color="#ff0000"><b><%=totalnumber%></b></font>篇文章
<%if CurrentPage<2 then%>
 首页 上一页 
<%else%>
 <a href="<%=filename%>?page=1">首页</a> 
<a href="<%=filename%>?page=<%=CurrentPage-1%>">上一页</a> 
<%
end if
if n-currentpage<1 then
%>
下一页 末页
<%else%>
<a href="<%=filename%>?page=<%=CurrentPage+1%>">下一页</a>
<a href="<%=filename%>?page=<%=n%>">末页</a>
<%end if%>
 页次:<strong><font color="#ff0000"><%=CurrentPage%>/<%=n%></font></strong>页
</div>
<%
end function
%>

<html>
<head>
<title>控制面板</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE2 {
color: #215DC6;
font-weight: bold;
font-size: 14px;
}
#tb1 {
border: 1px solid #0000FF;
padding: 1px;
font-family: "宋体", Arial;
font-size: 12px;
margin: 1px;
}
.STYLE3 {color: #FF6600}
.STYLE4 {color: #FF0000}
-->
</style>
</head>
<body><table align="center" width="100%" border="0">
<tr align="center">
<td height="80" align="center"><br>
<br>
<br>
<span class="STYLE2">文章管理中心</span><br>
<table width="671" id=tb1>
<tr>
<td width="30" align="center" id=tb1>ID</td>
<td width="340" align="center" id=tb1>标题</td>
<td width="99" align="center" id=tb1>作者 </td>
<td width="80" align="center" id=tb1>时间 </td>
<td width="100" align="center" id=tb1>管理项目 </td>
</tr>
</table>
<table width="671" border="0" id=tb1>
<%
if rseof=1 then
%>
<tr>
<td align="center" class="table00">没有任何文章</td>
</tr>

<%
else
if currentPage=1 then
showContent

else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent

else
currentPage=1
showContent

end if
end if
end if
%>
<% if rseof<>1 then
%>
<tr>
<td align="right" class="table00" colspan="5">
<%
showpage totalput,MaxPerPage,PageUrl
%>
</td>
</tr>
<%
end if
%>
</table>

</td>
</tr>
</table>
</body>
</html>

ASP.NET 2.0中的页面输出缓存