Danielchenyu 2004年12月22日
高手赐教--有关分页问题,为什么这样写不对?
<%
dim rs,rs1,sql1
set rs = server.createobject("adodb.recordset")
sql = "SELECT * FROM news where class_num='"&class_num&"' ORDER BY webdate DESC"
'response.write sql
rs.open sql, conn, 1, 1
if rs.eof and rs.bof then
response.write "<br><font size=2>没有相关资讯内容</font>"
jjpage=1
else
dim curpage, i
if request("page")="" then
curpage = 1
else
curpage = cint(request("page"))
end if
rs.pagesize = 15
rs.absolutepage = curpage
for i = 1 to rs.pagesize
%>
<tr>
<td width="5%"> </td>
<td width="4%"><img src="images/news_page.gif" width="10" height="10"></div></td>
<td width="91%" height="30"><a href="news_view.asp?id=<%=rs("id")%>"><%=rs("title")%></a> <font color="#999999">(<%=rs("webdate")%>)</font><SPAN id=Label1>
<%if rs("webdate")>date()-7 then%>
<img src="images/news_new.gif" width="28" height="11">
<%end if%>
</SPAN></td>
</tr><% rs.movenext
if rs.eof then
i = i + 1
exit for
end if
next
end if%>
</table> </td>
</tr>
<tr>
<td height="20" colspan="3"> </td>
</tr>
<tr>
<td colspan="3"><div align="right">
<%if jjpage<>1 then
response.write "本页" + cstr(i-1) + "条/总" + cstr(rs.recordcount) + "条 "
if curpage = 1 then
response.write "首页 前页 "
else
response.write "<a href='news_more.asp?class_num="&strclass&"&page=1'>首页</a> <a href='news_more.asp?class_num="&strclass&"&page=" + cstr(curpage-1) + "'>前页</a> "
end if
if curpage = rs.pagecount then
response.write "后页 末页"
else
response.write "<a href='news_more.asp?class_num="&strclass&"&page=" + cstr(curpage+1) + "'>后页</a> <a href='news_more.asp?class_num="&strclass&"&page=" + cstr(rs.pagecount) + "'>末页</a>"
end if
End If
rs.close
%>
...全文
66 点赞 收藏 11
写回复
11 条回复

还没有回复,快来抢沙发~

发动态
发帖子
ASP
创建于2007-09-28

1.9w+

社区成员

35.7w+

社区内容

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区公告
暂无公告