哪里有ASP实现自动分页的教程,范例最好?

kill 2000-07-05 10:19:00
哪里有ASP实现自动分页的教程,范例最好
如果哪位有,请Email给我,谢了!!
Email: my2000@yahoo.com.cn
...全文
139 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xfile 2000-07-05
  • 打赏
  • 举报
回复
dim Title,Content,Date_Time,ChildMsgID
dim Author,Length,ReadTimes,Levels
dim rs_ListPost,ActiveConn,sql_str
dim RowCount,pagenum,previewPage,nextpage,i
',cnn_SavePost,rs_temp
dim TypeID,Email

sql_str="select * from tbl_PostInfo where Levels=1 Order by Date_time DESC"
'Response.Write sql_str

set rs_ListPost =server.CreateObject ("adodb.recordset")
ActiveConn="DSN=Baty-way"

rs_ListPost.Open sql_str, ActiveConn,adOpenStatic,adLockReadOnly,adCmdText

if NOT rs_ListPost.EOF then

'分页参数
rs_ListPost.AbsolutePage =1
rs_ListPost.PageSize =10

pagenum=request("pagenum")

if pagenum<>"" then
rs_ListPost.AbsolutePage =pagenum
else
pagenum=1
end if
RowCount=10
Response.Write "<ul>"

do while NOT rs_ListPost.EOF and RowCount>0
Response.Write "<li>"&vbCrlf

if datediff("h",rs_ListPost("Date_Time"),dateadd("h",-15,now()))<0 then
Response.Write "[NEW]"&vbCrlf
end if

Response.Write "<a href=showpost.asp?PostID="&rs_ListPost("PostID")&" target=_blank>"&rs_ListPost("Title")&"</a> - "&vbCrlf
Response.Write "<"&rs_ListPost("Length")&"字节>"&vbCrlf
Response.Write "<b><a href=getuserInfo.asp?UserName="&rs_ListPost("Author")&" target=_blank>"&rs_ListPost("Author")&"</a></b>"&vbCrlf
Response.Write rs_ListPost("Date_Time")&vbCrlf&"阅读次数:"&rs_ListPost("ReadTimes")&vbCrlf&"<br>"
Response.Write "</li>"

if rs_ListPost("ChildMsgID")<>"" and rs_ListPost("ChildMsgID")<>"0" then
'Response.Write rs_ListPost("ChildMsgID")
showchild rs_ListPost("ChildMsgID")
end if

rs_ListPost.MoveNext
RowCount=RowCount-1
loop

Response.Write "</ul>"&vbCrlf

else
Response.Write "本论坛暂时无贴!"&"<br>"
end if

if rs_ListPost.PageCount >1 then
Response.Write "帖子分页:<br>"

'写分页链接:
for i=1 to rs_ListPost.PageCount

if cint(pagenum)=i then
Response.Write i&vbCrlf
else
Response.Write "<a href=Listpost.asp?pagenum="&i&">"&i&"</a>"&vbCrlf
end if
next
end if

nextPage=pagenum+1
previewPage=pagenum-1

if cint(pagenum)>1 then
Response.Write "<a href=Listpost.asp?pagenum="&PreviewPage&">"&"<Preview>"&"</a>"&vbCrlf
end if

if cint(pagenum)<>rs_ListPost.PageCount then
Response.Write "<a href=Listpost.asp?pagenum="&NextPage&">"&"<Next>"&"</a>"&vbCrlf
end if

Response.Write "<a href=Listpost.asp?pagenum="&pagenum&">"&"<Refresh>"&"</a>"&vbCrlf
Response.Write "<a href=AddPost.asp target=_blank>"&"<AddNew>"&"</a>"&vbCrlf

rs_ListPost.Close
set rs_ListPost=nothing
zdg 2000-07-05
  • 打赏
  • 举报
回复
自动分页的概念是什么???
ASP的RecordSet支持分页, 指定PageSize就可以了...例子如下:

Set rs=Server.CreateObject("ADODB.Recordset")
rs.PageSize=30
rs.Open sql, Conn, 3
rs.AbsolutePage=2
maxID=rs.RecordCount
P=rs.PageCount
TopHead 2000-07-05
  • 打赏
  • 举报
回复
你可以看看VID中的DTC控件Grid它能自动分页:)

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧