置向上移行 rs.movefirst将记录指针移到数据表第行 rs.movelast将记录指针移到数据表最后行 rs.absoluteposition=N将记录指针移到数据表第N行 rs.absolutepage=N将记录指针移到第N页第行 rs.pagesize=N设置每页为N条记录 rs.pagecount根据pagesize设置返回总页数 rs.recordcount返回记录总数 rs.bof返回记录指针是否超出数据表首端true表示是false为否 rs.eof返回记录指针是否超出数据表末端true表示是false为否 rs.delete删除当前记录但记录指针不会向下移动 rs.add添加记录到数据表末端 rs.update更新数据表记录
判断所填数据是数字型 notisNumeric(request(\"字段名称\"))then response.write\"不是数字\" response.write\"数字\" end
-------------------------------------------------------------------------------simpleli于2002-03-2315:08:45加贴在ASP论坛上 -------------------------------------------------------------------------------内容(3469s):
这是论坛分页显示,你改下就行了 <%SubShowList%> <% PgSz=20\'设定开关指定每页所显示贴子数默认为20贴子页 SetConn=Server.CreateObject(\"ADODB.Connection\") SetRS=Server.CreateObject(\"ADODB.RecordSet\") sql=\"SELECT*FROMmessageorderbyIDDESC\" \'查询所有帖子并按帖子ID倒序排列 Conn.Open\"
bbs\" RS.opensql,Conn,1,1 IfRS.RecordCount=0then response.write\"
对不起数据库中没有相关信息!\" RS.PageSize=C(PgSz)\'设定PageSize属性值 Total=INT(RS.recordcount/PgSz*-1)*-1\'计算可显示页面总数 PageNo=Request(\"pageno\") PageNo=\"\"Then PageNo=1
PageNo=PageNo+1 PageNo=PageNo-1 end ScrollAction=Request(\"ScrollAction\") ScrollAction=\"上页\"Then PageNo=PageNo-1 end ScrollAction=\"下页\"Then PageNo=PageNo+1 end PageNo<1Then PageNo=1 end n=1 RS.AbsolutePage=PageNo Response.Write\"
\" position=RS.PageSize*PageNo pagebegin=position-RS.PageSize+1 position pagend=RS.RecordCount end Response.Write\"数据库查询结果:\" Response.Write\"(共有\"&;RS.RecordCount&;\"条符合条件信息,显示\"&;pagebegin&;\"\"&;pagend&;\")
\" Response.Write\"\" Response.Write\"主题 | 用户 | Email | 发布日期 | \" Dowhilenot(RSisnothing) RowCount=RS.PageSize DoWhileNotRS.EOFandrowcount>0
Ifn=1then Response.Write\"\" ELSE Response.Write\" EEE>\" EndIf n=1-n%> \'><%=RS(\"subject\")%> | xml:namespace prefix = spanstyle=\"font-size /><%=RS(\"name\")%> | \"><%=RS(\"email\")%> | <%=RS(\"postdate\")%> | <% RowCount=RowCount-1 RS.MoveNext Loop RS=RS.NextRecordSet Loop Conn.Close rs=nothing Conn=nothing %> \"> <% PageNo>1Then response.write\"\" end RowCount=0andPageNo<>Totalthen response.write\"\" end response.write\"\" End %>
<%EndSub%>
翻页代码:
<%MaxPerPage=8 \'定义页面最大记录数为8
not isempty(request(\"page\")) then
currentPage=c(request(\"page\")) \'currentpage我们作为当前页面变量获得当前页数值
currentPage=1 \'如果为空就设为1
end
sql=\"select * from article order by id desc\" \'sql语句查询article表中所有数据
Set rs= Server.CreateObject(\"ADODB.Record\")
rs.open sql,conn,1,1 \'执行sql语句
rs.eof and rs.bof then
response.write \"
还 没 有 任 何 文 章
\"
totalPut=rs.recordcount \'把查询到文章总数值付给totalput变量(设置第页)
currentpage<1 then \'如果小于1
currentpage=1
end
(currentpage-1)*MaxPerPage>totalput then \'设置最后页如果有溢出计算页值
(totalPut mod MaxPerPage)=0 then
currentpage= totalPut \\ MaxPerPage
currentpage= totalPut \\ MaxPerPage + 1
end
end
currentPage=1 then \'如果是第页
showpage totalput,MaxPerPage,\"index.asp\" \'执行showpage显示分页
showContent \'执行showContent,显示内容
showpage totalput,MaxPerPage,\"index.asp\" \'执行showpage显示分页
\'如果不是
(currentPage-1)*MaxPerPage rs.move (currentPage-1)*MaxPerPage \'把记录指针移到当前页开头
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,\"ind