ASP分页代码,请大家帮帮忙,加下分页代码
这个加分页代码应该怎么加进去呢?加了好久也没搞明白,请大家帮帮忙<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%><!--#includefil...
这个加分页代码应该怎么加进去呢?加了好久也没搞明白,请大家帮帮忙
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>记录</TITLE>
</head>
<body>
<a href="?type=0">1记录</a> <a href="?type=1">2记录</a>
<%
if request.QueryString("type")=1 then
%>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>用户id</td>
<td>用户名</td>
<td>时间</td>
<td>id</td>
<td>名称</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from djjl where type=True order by id desc"
rs.open sql,conn,1,3
while not rs.eof
%>
<tr>
<td><%=rs("userid")%></td>
<td><%=rs("username")%></td>
<td><%=rs("up_time")%></td>
<td><%=rs("up_id")%></td>
<td><%=rs("up_name")%></td>
</tr>
<%
rs.movenext
wend
rs.close
%>
</table>
<%
else
%>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>用户id</td>
<td>用户名</td>
<td>时间</td>
<td>id</td>
<td>名称</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from djjl where type=false order by id desc"
rs.open sql,conn,1,3
while not rs.eof
%>
<tr>
<td><%=rs("userid")%></td>
<td><%=rs("username")%></td>
<td><%=rs("down_time")%></td>
<td><%=rs("down_id")%></td>
<td><%=rs("down_name")%></td>
</tr>
<%
rs.movenext
wend
rs.close
%>
</table>
<%
end if
%>
</BODY>
</HTML>
回答者ktscript: 这个只展示了,并没有加分页啊
就是不会加分页代码啊,才提问的啊 展开
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>记录</TITLE>
</head>
<body>
<a href="?type=0">1记录</a> <a href="?type=1">2记录</a>
<%
if request.QueryString("type")=1 then
%>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>用户id</td>
<td>用户名</td>
<td>时间</td>
<td>id</td>
<td>名称</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from djjl where type=True order by id desc"
rs.open sql,conn,1,3
while not rs.eof
%>
<tr>
<td><%=rs("userid")%></td>
<td><%=rs("username")%></td>
<td><%=rs("up_time")%></td>
<td><%=rs("up_id")%></td>
<td><%=rs("up_name")%></td>
</tr>
<%
rs.movenext
wend
rs.close
%>
</table>
<%
else
%>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>用户id</td>
<td>用户名</td>
<td>时间</td>
<td>id</td>
<td>名称</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from djjl where type=false order by id desc"
rs.open sql,conn,1,3
while not rs.eof
%>
<tr>
<td><%=rs("userid")%></td>
<td><%=rs("username")%></td>
<td><%=rs("down_time")%></td>
<td><%=rs("down_id")%></td>
<td><%=rs("down_name")%></td>
</tr>
<%
rs.movenext
wend
rs.close
%>
</table>
<%
end if
%>
</BODY>
</HTML>
回答者ktscript: 这个只展示了,并没有加分页啊
就是不会加分页代码啊,才提问的啊 展开
展开全部
分太少
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>记录</TITLE>
</head>
<body>
<a href="?type=0">1记录</a> <a href="?type=1">2记录</a>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>用户id</td>
<td>用户名</td>
<td>时间</td>
<td>id</td>
<td>名称</td>
</tr>
<%
page=clng(request("page"))
set rs=server.createobject("adodb.recordset")
if request.QueryString("type")=1 then
sql="select * from djjl where type=True order by id desc"
else
sql="select * from djjl where type=false order by id desc"
end if
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.Write("暂时没有记录")
else
rs.PageSize=10 '每页显示的信息数目
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize %>
<tr>
<td><%=rs("userid")%></td>
<td><%=rs("username")%></td>
<td><%=rs("up_time")%></td>
<td><%=rs("up_id")%></td>
<td><%=rs("up_name")%></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
<tr><td colspan="5" align="center">
<form method=Post action="">
<%if Page<2 then
response.write "首页 上一页 "
else
response.write "<a href=?page=1>首页</a> "
response.write "<a href=.asp?page=" & Page-1 & ">上一页</a> "
end if
if rs.pagecount-page<1 then
response.write "下一页 尾页"
else
response.write "<a href=.asp?page=" & (page+1) & ">"
response.write "下一页</a> <a href=.asp?page="&rs.pagecount&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
response.write " 共<b><font color='#FF0000'>"&rs.recordcount&"</font></b>条记录 <b>"&rs.pagesize&"</b>条记录/页"
response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=input value="&page&">"
response.write " <input class=input type='submit' value=' Goto ' name='cndok'></span></p>"
%>
</form>
</td></tr>
</table>
<% end if
rs.close
set rs=nothing%>
</BODY>
</HTML>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>记录</TITLE>
</head>
<body>
<a href="?type=0">1记录</a> <a href="?type=1">2记录</a>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>用户id</td>
<td>用户名</td>
<td>时间</td>
<td>id</td>
<td>名称</td>
</tr>
<%
page=clng(request("page"))
set rs=server.createobject("adodb.recordset")
if request.QueryString("type")=1 then
sql="select * from djjl where type=True order by id desc"
else
sql="select * from djjl where type=false order by id desc"
end if
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.Write("暂时没有记录")
else
rs.PageSize=10 '每页显示的信息数目
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize %>
<tr>
<td><%=rs("userid")%></td>
<td><%=rs("username")%></td>
<td><%=rs("up_time")%></td>
<td><%=rs("up_id")%></td>
<td><%=rs("up_name")%></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
<tr><td colspan="5" align="center">
<form method=Post action="">
<%if Page<2 then
response.write "首页 上一页 "
else
response.write "<a href=?page=1>首页</a> "
response.write "<a href=.asp?page=" & Page-1 & ">上一页</a> "
end if
if rs.pagecount-page<1 then
response.write "下一页 尾页"
else
response.write "<a href=.asp?page=" & (page+1) & ">"
response.write "下一页</a> <a href=.asp?page="&rs.pagecount&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
response.write " 共<b><font color='#FF0000'>"&rs.recordcount&"</font></b>条记录 <b>"&rs.pagesize&"</b>条记录/页"
response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=input value="&page&">"
response.write " <input class=input type='submit' value=' Goto ' name='cndok'></span></p>"
%>
</form>
</td></tr>
</table>
<% end if
rs.close
set rs=nothing%>
</BODY>
</HTML>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>记录</TITLE>
</head>
<body>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>用户id</td>
<td>用户名</td>
<td>时间</td>
<td>id</td>
<td>名称</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from djjl where type=True order by id desc"
rs.open sql,conn,1,3
cnum=rs.recordcount
if cnum=0 then
else
dim page
page=Clng(request("page"))
ppage="page="&page&"&"
rs.pagesize=20
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.Absolutepage=page
for i=1 to rs.pagesize
%>
<tr>
<td><%=rs("userid")%></td>
<td><%=rs("username")%></td>
<td><%=rs("up_time")%></td>
<td><%=rs("up_id")%></td>
<td><%=rs("up_name")%></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
End If
%>
<tr>
<td align="center" class="forumrow" colspan="7" height="25"><%
Response.Write "总共有<font color=red>"&cnum&"</font>条"
if page<>1 then
response.write "<a href=?page=1>首页</a> "
response.write "<a href=?page="&(page-1)&">上一页</a> "
end if
if page<>rs.pagecount then
response.write "<a href=?page="&(page+1)&">下一页</a> "
response.write "<a href=?page="&rs.pagecount&">尾页</a> "
end if
rs.close:set rs=nothing
%></td>
</tr>
</table>
</BODY>
</HTML>
<!--#include file="Conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>记录</TITLE>
</head>
<body>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>用户id</td>
<td>用户名</td>
<td>时间</td>
<td>id</td>
<td>名称</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from djjl where type=True order by id desc"
rs.open sql,conn,1,3
cnum=rs.recordcount
if cnum=0 then
else
dim page
page=Clng(request("page"))
ppage="page="&page&"&"
rs.pagesize=20
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.Absolutepage=page
for i=1 to rs.pagesize
%>
<tr>
<td><%=rs("userid")%></td>
<td><%=rs("username")%></td>
<td><%=rs("up_time")%></td>
<td><%=rs("up_id")%></td>
<td><%=rs("up_name")%></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
End If
%>
<tr>
<td align="center" class="forumrow" colspan="7" height="25"><%
Response.Write "总共有<font color=red>"&cnum&"</font>条"
if page<>1 then
response.write "<a href=?page=1>首页</a> "
response.write "<a href=?page="&(page-1)&">上一页</a> "
end if
if page<>rs.pagecount then
response.write "<a href=?page="&(page+1)&">下一页</a> "
response.write "<a href=?page="&rs.pagecount&">尾页</a> "
end if
rs.close:set rs=nothing
%></td>
</tr>
</table>
</BODY>
</HTML>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询