一聚教程网:一个值得你收藏的教程网站

热门教程

asp分页代码

时间:2022-07-02 22:45:13 编辑:袖梨 来源:一聚教程网

这是一段简单的asp分页显示代码并以asp 分页显示源代码的形式提供给大家,

 代码如下 复制代码

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>




无标题文档


<%
dim Conn,rs
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = "Dbq="&Server.MapPath("liouyan.mdb")&"; Driver={Microsoft Access Driver (*.mdb)}"
Conn.Open
set rs=Server.createObject("ADODB.RecordSet")
SQL="select * from userinfo"
rs.open SQL,Conn,1,1
if Not rs.Bof and Not rs. Eof then
dim page_no
if request.QueryString("page_no")="" then
page_no=1
else
page_no=Cint(Request.QueryString("page_no"))
end if
rs.pageSize=5
rs.AbsolutePage=page_no
dim I
I=rs.pageSize
do while Not rs.Eof and I>0
I=I-1
response.write rs("username") &"对你说:"&rs("word")& "
"
rs.MoveNext
loop
response.write"请选择数据页:"
for I=1 to rs.pageCount
if I=page_no then
response.write I &" "
else
response.write"" &I &" "
end if
next
else
response.write"该记录集为空"
end if
rs.close
set rs=nothing
Conn.close
set Conn=nothing
%>

热门栏目