怎么给这段代码实现分页功能
<%Setrs=Server.CreateObject("ADODB.Recordset")ifrequest("action")="dc"thenrs.open"sel...
<%
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=request("xing")
xg_ming=request("ming")
xg_province=request("province")
xg_body=replace(xg_body,"<","<")
xg_body=replace(xg_body,">",">")
rs.open "select * from xg_ly order by xg_id asc",conn,1,3
xg_id=rs("xg_id")
xg_xing=rs("xing")
xg_ming=rs("ming")
xg_province=rs("province")
xg_count=rs.recordcount
rs.addnew
rs("xg_body")=xg_body
rs("xg_xing")=xg_xing
rs("xg_ming")=xg_ming
rs("xg_province")=xg_province
rs.update
rs.close
if xg_count=20 then conn.execute "delete xg_id from xg_ly where xg_id="&xg_id
rs.open "select xg_number from xg_xin",conn,1,3
xg_number=rs("xg_number")+1
rs("xg_number")=rs("xg_number")+1
rs.update
rs.close
response.write"<SCRIPT language=JavaScript>alert('您是本网第"&xg_number&"位网友,为中国加油!');window.location='index.asp';</SCRIPT>"
end if
sub xg_ly()
rs.open "select top 20 * from xg_ly order by xg_id desc",conn,1,1
do while not rs.eof
Response.Write "<DIV class=list_01 align=left>"&rs("xg_province")&" "&rs("xg_xing")&""&rs("xg_ming")&" <SPAN class=font_08>留下祝福:</SPAN>“"&rs("xg_body")&"” <SPAN class=div_time>"&rs("xg_time")&"</SPAN></DIV>"
rs.movenext
loop
rs.close
end sub
rs.open "select xg_number from xg_xin",conn,1,1
xg_number=rs("xg_number")
rs.close
rs.open "select * from xg_dc",conn,1,1
xg_dca=rs("xg_a")
xg_dcb=rs("xg_b")
xg_dcc=rs("xg_c")
xg_dcd=rs("xg_d")
xg_dce=rs("xg_e")
xg_dcf=rs("xg_f")
rs.close
%> 展开
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=request("xing")
xg_ming=request("ming")
xg_province=request("province")
xg_body=replace(xg_body,"<","<")
xg_body=replace(xg_body,">",">")
rs.open "select * from xg_ly order by xg_id asc",conn,1,3
xg_id=rs("xg_id")
xg_xing=rs("xing")
xg_ming=rs("ming")
xg_province=rs("province")
xg_count=rs.recordcount
rs.addnew
rs("xg_body")=xg_body
rs("xg_xing")=xg_xing
rs("xg_ming")=xg_ming
rs("xg_province")=xg_province
rs.update
rs.close
if xg_count=20 then conn.execute "delete xg_id from xg_ly where xg_id="&xg_id
rs.open "select xg_number from xg_xin",conn,1,3
xg_number=rs("xg_number")+1
rs("xg_number")=rs("xg_number")+1
rs.update
rs.close
response.write"<SCRIPT language=JavaScript>alert('您是本网第"&xg_number&"位网友,为中国加油!');window.location='index.asp';</SCRIPT>"
end if
sub xg_ly()
rs.open "select top 20 * from xg_ly order by xg_id desc",conn,1,1
do while not rs.eof
Response.Write "<DIV class=list_01 align=left>"&rs("xg_province")&" "&rs("xg_xing")&""&rs("xg_ming")&" <SPAN class=font_08>留下祝福:</SPAN>“"&rs("xg_body")&"” <SPAN class=div_time>"&rs("xg_time")&"</SPAN></DIV>"
rs.movenext
loop
rs.close
end sub
rs.open "select xg_number from xg_xin",conn,1,1
xg_number=rs("xg_number")
rs.close
rs.open "select * from xg_dc",conn,1,1
xg_dca=rs("xg_a")
xg_dcb=rs("xg_b")
xg_dcc=rs("xg_c")
xg_dcd=rs("xg_d")
xg_dce=rs("xg_e")
xg_dcf=rs("xg_f")
rs.close
%> 展开
1个回答
展开全部
下面是我用过的
<%
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 ></td>
<td ></td>
<td ></td>
<td></td>
<td ></td>
<%
loopno=loopno-1
rs.movenext
ii=ii-1
wend
wend
end if
%>
</tr>
<%rs.close%>
<%
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 ></td>
<td ></td>
<td ></td>
<td></td>
<td ></td>
<%
loopno=loopno-1
rs.movenext
ii=ii-1
wend
wend
end if
%>
</tr>
<%rs.close%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询