请问以下代码,为何点击“下页”后,序号又从1开始,我要接上一序号,错在哪里?谢!
试例.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
set conn1=server.createobject("adodb.connection")
sql1 = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBc;SourceDb="&server.mappath("/qssjk.dbc")
conn1.open(sql1)
%>
<%
set rs1=server.createobject("adodb.recordset")
sql1="select * FROM snfhns "
%>
<%
rs1.activeconnection=conn1
rs1.open sql1,conn1,1,1
%>
<table>
<tr >
<td>序号</td>
<td>姓名</td>
</tr>
<!--循环-->
<%
if Not(rs1.bof and rs1.eof) then'判别数据表中是否为空记录
NumRecord=rs1.recordcount '记录数
rs1.pagesize=25
'每页行数
NumPage=rs1.Pagecount
'总页数
if request("page")=empty then
NoncePage=1
else
if Cint(request("page"))<1 then
NoncePage=1
else
NoncePage=request("page")
end if
if Cint(Trim(request("page")))>Cint(NumPage) then NoncePage=NumPage
end if
else
NumRecord=0 '记录数
NumPage=0
'总页数
NoncePage=0 '页号
end if
%>
<%
'序号
if Request("offset")="" then
i=1
else
i=Request("offset")+1
end if
'页数
if Not(rs1.bof and rs1.eof) then
rs1.move (Cint(NoncePage)-1)*25,1
for j=1 to rs1.pagesize
%>
<tr>
<td><%= i %></td>
<td><%=rs1("县名")%></td>
</tr>
<%
i=i+1
rs1.movenext
if rs1.eof then exit for
next
else
response.write "<tr><td>无记录!</td></tr>"
end if
%>
</table>
<!--分页显示-->
<table >
<tr>
<td width="15%" align="center">
<%
if NoncePage>1 then
response.write "<a href=试例.asp?page=1>首 页</a> <a href=试例.asp?page="&NoncePage-1&">上 页</a> "
else
response.write "首 页 上 页 "
end if
%>
</td>
<td width="15%" align="center">
<%
if Cint(Trim(NoncePage))<Cint(Trim(NumPage)) then
response.write "<a href=试例.asp?page="&NoncePage+1&">下 页</a> <a href=试例.asp?page="&NumPage&">尾 页</a>"
else
response.write "下 页 尾 页"
end if
%>
</td>
<td width="70%">
页次:<%=NoncePage%>/<%=NumPage%> 共<font color="#0033CC"><%=NumRecord%>条记录 </div>
</td>
</tr>
</table>
<%
rs1.close()
set rs1=nothing
%>