It is OK in Dreamwerver that everybody knows very the cent page that realizes record volume conveniently shows, but generated code is very giant really, affected the indication rate of the webpage, look consecution also is not very clear, so, can you realize same function in order to use simple means? OK of course, the author is passed a few more the following the cent page that simple code realized to record part shows, take everybody to be shared together now.
Main code is as follows:
<%
If rs1.recordcount>0 Then ‘ 记录集不为空则处理记录
rs1.pagesize = 10 ‘ 设置每页显示的记录数
num=rs1.recordcount ‘ 记录总数
pagenum=rs1.pagecount ‘ 页总数
page=request(”page”) ‘ 获取页码的原始信息
’ 处理页码原始信息的开始!
If page <> “” then
page = cint(page)
if err.number <> 0 then
err.clear
page = 1
end if
if page < 1 then
page = 1
end if
else
page = 1
End if
if page*rs1.pagesize > num and not((page-1)*rs1.pagesize < num)then
page=1
end if
’ 处理页码原始信息的结束!设置当前页码
rs1.absolutepage = page
%>
<!–判断当前页是否是最后一页,并根据判断设置记录的重复显示–>
<% if page<>pagenum then
lablenum=rs1.pagesize
else
lablenum=num-(page-1)*rs1.pagesize
end if
for i=1 to lablenum
%>
<tr bgcolor=”#FFFFFF”>
<td height=”25″><div align=”center”><%=(rs1.Fields.Item(”id”).Value)%></div></td>
<td><div align=”center”><%=(rs1.Fields.Item(”名称”).Value)%></div></td>
<td><div align=”center”><%=(rs1.Fields.Item(”地址”).Value)%></div></td>
<td><div align=”center”><%=(rs1.Fields.Item(”类别”).Value)%></div></td>
<td><div align=”center”><%=(rs1.Fields.Item(”最后修改”).Value)%></div></td>
<td><div align=”center”><%=(rs1.Fields.Item(”修改人”).Value)%></div></td>
</tr>
<%
rs1.movenext
next
%>
<!–当前页的记录显示结束,以下代码为记录集分页链接代码–>
<table width=”70%” border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″>
<tr>
<td height=”35″>
<div align=”right”>
<font color=”#333333″>
共有 <%=num%> 个链接 |
<a href=linkadmin.asp?page=1>首页</a> |
<%if page>1 then%><a href=linkadmin.asp?page=<%=page-1%>><%end if%>上一页</a> |
<%if page<pagenum then%><a href=linkadmin.asp?page=<%=page 1%>><%end if%>下一页</a> |
<a href=linkadmin.asp?page=<%=pagenum%>>尾页</a> |
页次:<%=page%>/<%=pagenum%>页 |
共<%=pagenum%>页
</font>
</div>
</td>
</tr>
</table>
<!–记录集分页链接代码结束,记录集为空时执行以下代码–>
<%else%>
<tr bgcolor=”#FFFFFF”>
<td height=”25″ colspan=”6″><div align=”center”><% response.Write(”没有结果可显示!”) %>
</div></td>
</tr>
<%
end if
rs1.Close()
Set rs1 = Nothing
%>
Good, very simple! Should revise the place that shows a record with respect to the webpage that can insert you simply only, try at once!
