关于一个简单的分页程序的问题
关于一个简单的分页程序,在ACCESS下测试正常,可是在SQL SERVER 2000下就出现问题,第一页显示-1页,而上一页却是第0页,大家帮我看看是怎么了?
<%
pro_class=rtrim(request( "pro_class "))
set rs=server.CreateObject( "adodb.recordset ")
sql= "select * from product where rtrim(pro_class)= ' "&pro_class& " ' order by id desc "
rs.open sql,conn,1,1
if not rs.eof then
page=request.QueryString( "page ")
rs.pagesize=6
total=rs.recordcount
if Not IsEmpty(ltrim(rtrim(Request( "Page ")))) then
page = CInt(Request( "page "))
if page > rs.PageCount then
rs.AbsolutePage = rs.PageCount
elseif page <= 0 then
page = 1
else
rs.AbsolutePage = page
end if
End if
page = rs.AbsolutePage
end if
%>
下面显示的代码:
<%if rs.pagecount <> 1 and rs.pagecount <> 0 then%>
<%if page <rs.pagecount then%>
<%if page> 1 then %>
[首页] [上一页]
<%else%>
[ <a Href= "class_zhanshi.asp?page= <%=1%> &pro_class= <%=pro_class%> "> 首页 </a> ]
[ <a Href= "class_zhanshi?page= <% =page-1 %> &pro_class= <%=pro_class%> "> 上一页 </a> ]
<% end if %>