asp分页问题。求高手赐教。在线等高分求救。 是个显示问题。首页显示了全部的数据。分页无效了。不知怎的
<head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"><title>无标题文档</...
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<% const perpage=5
dim cupage
dim recordcount
dim pagecount
dim i
%>
</head>
<body>
<p>
<%
set conn=server.CreateObject("adodb.connection")
conn.open "driver={sql server}; uid=sa;pwd=dsduxinlin;database=liuyanban;server=(local)"
cupage=cint(request.QueryString("page"))
if cupage="" or cupage<=0 then
cupage=1
end if
set rs=server.CreateObject("adodb.recordset")
rs.pagesize=perpage
rs.open"select * from biaodan",conn,1,1
recordcount=rs.recordcount
pagecount=int(recordcount/perpage)
if recordcount mod perpage<>0 then
pagecount=pagecount+1
end if
if pagecount>1 then
rs.absolutepage=cupage
end if
if cupage>pagecount then
rs.abolutepage=pagecount
end if
response.Write "总共"&recordcount&"记录|"
response.Write"每页显示"&perpage&"条记录|"
response.Write"共"&pagecount&"页记录|"
response.Write"现在是第"&cupage&"页<br>"
%>
</p>
<table width="700" border="1">
<tr>
<td>序号</td>
<td>name</td>
<td>email</td>
<td>biaoti</td>
<td>neirong</td>
</tr>
<% While Not rs.Eof And i<=perPage %>
<tr>
<td><%=rs("留言序号")%></td>
<td><%=rs("姓名")%></td>
<td><%=rs("email")%></td>
<td><%=rs("主题")%></td>
<td><%=rs("留言")%></td>
</tr>
<% i=1
i=i+1
rs.movenext
wend
%>
</table>
<%
response.write"<a href='fyjs.asp'>首页</a>|"
if cupage>1 then
response.Write"<a href='fyjs.asp?page="&(cupage-1)&"'>上一页</a>"
end if
if cupage<pagecount then
response.Write "<a href='fyjs.asp?page="&(cupage+1)&"'>下一页</a>"
end if
response.Write"<a href='fyjs.asp?page="&pagecount&"'>尾页</a>"
%>
</body>
</html> 展开
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<% const perpage=5
dim cupage
dim recordcount
dim pagecount
dim i
%>
</head>
<body>
<p>
<%
set conn=server.CreateObject("adodb.connection")
conn.open "driver={sql server}; uid=sa;pwd=dsduxinlin;database=liuyanban;server=(local)"
cupage=cint(request.QueryString("page"))
if cupage="" or cupage<=0 then
cupage=1
end if
set rs=server.CreateObject("adodb.recordset")
rs.pagesize=perpage
rs.open"select * from biaodan",conn,1,1
recordcount=rs.recordcount
pagecount=int(recordcount/perpage)
if recordcount mod perpage<>0 then
pagecount=pagecount+1
end if
if pagecount>1 then
rs.absolutepage=cupage
end if
if cupage>pagecount then
rs.abolutepage=pagecount
end if
response.Write "总共"&recordcount&"记录|"
response.Write"每页显示"&perpage&"条记录|"
response.Write"共"&pagecount&"页记录|"
response.Write"现在是第"&cupage&"页<br>"
%>
</p>
<table width="700" border="1">
<tr>
<td>序号</td>
<td>name</td>
<td>email</td>
<td>biaoti</td>
<td>neirong</td>
</tr>
<% While Not rs.Eof And i<=perPage %>
<tr>
<td><%=rs("留言序号")%></td>
<td><%=rs("姓名")%></td>
<td><%=rs("email")%></td>
<td><%=rs("主题")%></td>
<td><%=rs("留言")%></td>
</tr>
<% i=1
i=i+1
rs.movenext
wend
%>
</table>
<%
response.write"<a href='fyjs.asp'>首页</a>|"
if cupage>1 then
response.Write"<a href='fyjs.asp?page="&(cupage-1)&"'>上一页</a>"
end if
if cupage<pagecount then
response.Write "<a href='fyjs.asp?page="&(cupage+1)&"'>下一页</a>"
end if
response.Write"<a href='fyjs.asp?page="&pagecount&"'>尾页</a>"
%>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询