怎么给这段代码实现分页功能

来源:百度知道 编辑:UC知道 时间:2024/05/18 11:23:51
<%
Set rs=Server.CreateObject("ADODB.Recordset")
if request("action")="dc" then
rs.open "select * from xg_dc",conn,1,3
if request("a")=1 then rs("xg_a")=rs("xg_a")+1
if request("b")=1 then rs("xg_b")=rs("xg_b")+1
if request("c")=1 then rs("xg_c")=rs("xg_c")+1
if request("d")=1 then rs("xg_d")=rs("xg_d")+1
if request("e")=1 then rs("xg_e")=rs("xg_e")+1
if request("f")=1 then rs("xg_f")=rs("xg_f")+1
rs.update
rs.close
response.write"<SCRIPT language=JavaScript>alert('提交成功');window.location='index.asp';</SCRIPT>"
elseif request("action")="ly" and request("body")<>"" then
xg_body=request("body")
xg_xing=r

下面是我用过的

<%
sql="select * from usertable where isok=1 order by id desc"
rs.open sql,conn,1,3
if pmcount="" or isempty(pmcount) or pmcount<1 then
pmcount=37 '每页37条记录
end if
rs.pagesize=pmcount '设置每页数
mpage=rs.pagecount '得到总页数
rcount=rs.recordcount '得到总条数
pageno=request("pageno")
if pageno="" then
pageno=1
end if
if isempty(pageno) or cint(pageno)<1 or cint(pageno)>mpage then
pageno=1
end if

if rs.bof and rs.eof then
response.write "<tr><td colspan='6'><div align='center'>没有信息</div></td></tr>"
else
rs.absolutepage=pageno '将指针移至指定页的第一条记录
loopno=pmcount
while not rs.eof and loopno>0
ii=1
%>
<tr><%while not rs.eof and loopno>0 and ii>0%>
<td >&l