开机不显示主板信息:求一段ASP分页代码。。会写的进。!

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 22:53:46
<%
set rs_Product=server.createobject("adodb.recordset")
sqltext="select top 16 * from Product order by ArticleID desc"
rs_Product.open sqltext,conn,1,1
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<%row_count=1 %>
<tr align="center">
<% Do While Not rs_Product.EOF%>
<td><table width="100%" height="105" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="32%"><div align="center">
<table width="88" cellpadding="1" cellspacing="1" bgcolor="#999999">
<tr>
<td align="center" valign="middle" bgcolor="#EFE7DE"><div align="center"> <a href="ArticleShow.asp?ArticleID=<%=rs_Product("articleid")%>"> <img border=0 src=<%=rs_Product("DefaultPicUrl")%> width=127 height=110></a><br>
<table width="100%" >
</table>
<a href="ArticleShow.asp?ArticleID=<%=rs_Product("articleid")%>"><%=rs_Product("Title")%></a><br>
$:<%=rs_Product("jiage2")%></div></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
<%if row_count mod 16 <>0 then%>
<%end if%>
<% if row_count mod 4 =0 then%>
</tr>
<tr>
<%end if%>
<%
rs_Product.MoveNext
row_count=row_count+1
Loop
rs_Product.close

%>

——————————————————————

以上是我整个数据读取的过程。。
如果何编写一段 上一页下一页 代码。 。要比较经典的。。

自己写了好几种。。但都不好用!

我自己用的通用分页程序,感觉效率还是比较的高的,自己参照你的数据库该一下就行了!
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文件管理系统</title>
</head>
<!--#include file="style.asp"-->
<body topmargin="0" bottommargin="0">
<!--#include file="top.asp"-->
<div align="center">
<table border="0" width="780" cellspacing="1" style="border-collapse: collapse" bordercolor="#666666" id="table1" bgcolor="ffffff" height="19">
<tr>
<td align="center" valign="top" bgcolor="#FFFFFF">
<div align="center">
<table width="768" border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse">
<tr>
<td align="center" width="21%" height="22" style="font-family: 宋体; font-size: 12px" background="../sheji/image/top_3_bg.gif"><span lang="zh-cn">文件名称</span></td>
<td width="36%" align="center" style="font-family: 宋体; font-size: 12px" height="22" background="../sheji/image/top_3_bg.gif">存储路径</td>
<td width="15%" align="center" style="font-family: 宋体; font-size: 12px" height="22" background="../sheji/image/top_3_bg.gif">文件类型</td>
<td width="15%" align="center" style="font-family: 宋体; font-size: 12px" height="22" background="../sheji/image/top_3_bg.gif">发布时间</td>
<td width="10%" height="22" align="center" style="font-family: 宋体; font-size: 12px" background="../sheji/image/top_3_bg.gif">发布者</td>
</tr>
<%
dim page
dim nowpage
dim nextpage
dim backpage ,paixu,rs,i,j,zuozhe,k,bg
k=1
page=Request("page")
paixu=Request("paixu")
if page="" then
page=1
else
page=cint(Request("page"))
end if
set rs=server.createobject("adodb.recordset")
rs.open "select * from file order by id desc",conn,1,1
rs.PageSize=15
nowpage="list.asp"
nextpage=page+1
if nextpage>rs.pagecount then
nextpage=page
end if
backpage=page-1
if backpage=0 then
backpage=1
if not rs.eof then
rs.AbsolutePage=page
for i=1 to rs.PageSize
if (k mod 2)=1 then
bg="#e1e1e1"
else bg=""
end if
%>
<tr>
<td align="center" width="21%" height="22" bgcolor="<%=bg%>"><%=rs("name")%></td>
<td width="36%" align="center" bgcolor="<%=bg%>" height="22"><a href="<%=rs("filepath")&rs("filename")%>">...<%=right(trim(rs("filepath")&rs("filename")),20)%></a></td>
<td width="15%" align="center" bgcolor="<%=bg%>" height="22"><%=rs("filetype")%>
</td>
<td width="15%" align="center" bgcolor="<%=bg%>" height="22"><%=rs("time")%></td>
<td width="10%" height="22" align="center" bgcolor="<%=bg%>"><%=rs("zuozhe")%></td>
</tr>
<%
rs.movenext
k=k+1
if rs.EOF Then Exit For
next
else
%>
<tr>
<td height="22" colspan="6">
<p align="center">暂无内容</td>
</tr>
<% end if %>
<tr>
<td height="22" colspan="6">
<p align="center">
<%
j=rs.pagecount
for i=1 to j
if i=page then
%>
<b>[<%=i%>]</b>
<%
else%>
<a href="<%=nowpage%>&page=<%=i%>">[<%=i%>]</a>
<%
end if
next
%>
</td>
</tr>
<tr>
<td height="22" colspan="6" background="../sheji/image/top_2_bg.gif">
<p align="center">
<%
if j=1 then
%>
第一页 上一页 下一页 最后一页 <%=page %>页/<%= rs.pagecount %>页 共有<%= rs.recordcount%>条记录
<%else
if page-1=0 then
%>
第一页 上一页 <a href="<%=nowpage%>&page=<%=nextpage%>">下一页</a>
<a href="<%=nowpage%>&page=<%=j%>">最后一页</a> <%=page%>页/<%=j%>页 共有<%= rs.recordcount%>条记录
<%
else
if page<j then
%>
<a href="<%=nowpage%>&page=1">第一页</a>  <a href="<%=nowpage%>&page=<%=backpage%>">上一页</a> 
<a href="<%=nowpage%>&page=<%=nextpage%>">下一页</a>  <a href="<%=nowpage%>&page=<%=j%>">最后一页</a>
<%=page %>页/<%= j %>页 共有<%= rs.recordcount%>条记录
<% else
%>
<a href="<%=nowpage%>&page=1">第一页</a>  <a href="<%=nowpage%>&page=<%=backpage%>">上一页</a> 
下一页 最后一页
<%=page %>页/<%= rs.pagecount %>页 共有<%= rs.recordcount%>条记录
<%
end if
end if
end if
%>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
<%
rs.close
conn.close
set rs=nothing
set conn=nothing
%>

Function PageMenu(ByVal PageTotal,PageThis,URL2)
Dim PageStr
If PageThis<1 Then PageThis=1
'Response.Write "第" & PageThis & "/" & PageTotal & "页"
PageStr = PageStr & "<td><a href='" & Three(PageThis>1, URL2 & "&PageT=" & PageTotal & "&Page=" & (PageThis - 1),"#") & "' title='上一页'><<</a></td>"

PageStr = PageStr & "<td><a href='" & Three(PageThis<PageTotal, URL2 & "&PageT=" & PageTotal & "&Page=" & (PageThis + 1),"#") & "' title='下一页'>>></a></td>"
PageStr = "<table><tr>" & PageStr & "</tr></table>"
Response.Write PageStr
End Function