请大家帮我看看调试一下这个翻页程序!
我的翻页程序如下:
<!-- #Include File=conn.asp -->
<table width="630" border="0" cellspacing="0" cellpadding="0" align="center" height="286" background="../image/bg01.jpg">
<tr>
<td width="445" valign="top" align="left" height="298">
<%
sql="select * from enterprise_register "
rs.Open sql,conn,1,1
rs.PageSize =2
if Not Isempty(Request("ToPage")) then
ToPage = CInt(Request("ToPage"))
'则将它设定为最后一页
if ToPage > RS.PageCount then
RS.AbsolutePage = RS.PageCount
elseif ToPage <= 0 then
RS.AbsolutePage = 1
else
'将记录指针设定欲检视的分页
RS.AbsolutePage = ToPage
end if
End if
Current_Page=rs.absolutepage '''''这的值current_page总是"-1"
%>
<H3 align="left" style="margin-top: -1; margin-bottom: -1">
</H3>
<H3 align="left" style="margin-top: -1; margin-bottom: -1"><font size="2" color="#000080">目前的分页状况为<FONT SIZE = 4 COLOR = red>
<% = Current_Page %>/<% = RS.PageCount %></FONT>页</font>
</H3>
<p align="left" style="margin-top: -1; margin-bottom: -1">
</p>
<%
Display_Page RS,Current_page
%>
<TABLE width="580" algin="right">
<TR valign=baseline align=right>
<%
if Current_Page <> 1 then
%>
<TD Width=145 align="right">
<p align="left">
<A Href=gzfy.asp?ToPage=<% = 1%>>第一页</A>
</p>
</TD>
<TD Width=145>
<p align="left">
<A Href=gzfy.asp?ToPage=<% =Current_Page- 1%>>上一页</A>
</p>
</TD>
<%
end if
if Current_Page <> RS.PageCount then
%>
<TD Width=145>
<p align="left">
<A Href=gzfy.asp?ToPage=<% = Current_Page + 1%>>下一页</A>
</p>
</TD>
<TD Width=144>
<p align="left">
<A Href=gzfy.asp?ToPage=<% = RS.PageCount%>>最后一页</A>
</p>
</TD>
<%
end if
%>
<TD Width=132 algin="right">
<FORM action=gzfy.asp method=POST>
<p align="left">
<!--在此提供一个给用户输入页数的字段 -->
到
<INPUT type="text" name=ToPage style="HEIGHT: 25px; WIDTH: 40px"
value=<% = CurrentPage%>> 页
</FORM></TD></TR>
</TABLE>
<%
Set RS = Nothing '重设RS对象
%>
<%Sub Display_Page(RS,page)
'设定记录指针指向的页数
' RS.AbsolutePage=page
'先在表格上方填入数据域位%>
<%'利用For循环配合PageSize属性输出一页中的记录
For i = 1 to RS.PageSize
'先使用if判断在最后一页记录时,是否有
'将记录指针移至最后一条记录之后
if RS.EOF then
Exit For '跳出For循环
end if
Row = "<TR BGCOLOR=#FFFF00> <TD>" & RS.AbsolutePosition & "</TD>"
%>
<table border="0" width="118%" algin="right" cellspacing="2" cellpadding="2" background="image/bg01.jpg">
<tr>
<td width="5%"><% Row = "<TR BGCOLOR=#cfdafa> <TD>" & RS.AbsolutePosition & "</TD>"
response.write row %></td>
<td width="60%" algin="left" align="left">
<p align="left"><font color="#000080"><a href="gzfyshow.asp?bt=<%=rs(1)%> " >
<%=rs(1)%></font></a></td>
<td width="25%" align="left">
<p align="left"><font color="#000080"><%=rs(4)%></font></td>
</tr>
</table>
<% RS.MoveNext
next
End Sub %>
</table>
Current_Page=rs.absolutepage '''''这的值current_page总是"-1"