叶子ASP分页类Bug两种修复方法

叶子asp分页类是效率十分好一个分页类,但在最后的0.12版中还存在微小的bug,本文作者提供了两种修复方法供大家参考。    叶子分页类v1.2中,190行: view sourceprint?1 '此处是为了修正access记录多并且最后一页只有一条记录则报Eof的bug,坏处就是最后一页会显示2条=___=
    2 If iPageIndex > 1 And iPageIndex = iPageCount And (iRecordCount Mod iPageSize = 1) Then
    3 Rs.AbsolutePosition = (iPageIndex - 1) * iPageSize
    4 Else
    5 Rs.AbsolutePosition = (iPageIndex - 1) * iPageSize + 1
    6 End If
    方法一:使用静态游标(即oConn,1,1改为oConn,3,1) view sourceprint?1 Set Rs = Server.CreateObject ("Adodb.RecordSet")
    2 Rs.Open "SELECT " & sField & " FROM " & sTable & " " & sCondition & " " & sOrderBy,oConn,3,1,&H0001
    3 '此处是为了修正access记录多并且最后一页只有一条记录则报Eof的bug,坏处就是最后一页会显示2条
    4 Rs.AbsolutePosition = (iPageIndex - 1) * iPageSize + 1
    方法二: view sourceprint?1 Set Rs = Server.CreateObject ("Adodb.RecordSet")
    2 Rs.Open "SELECT " & sField & " FROM " & sTable & " " & sCondition & " " & sOrderBy,oConn,1,1,&H0001
    3 '此处是为了修正access记录多并且最后一页只有一条记录则报Eof的bug,坏处就是最后一页会显示2条=___=
    4 If iPageIndex >1 and iPageIndex = iPageCount Then
    5     Rs.Move (iPageIndex-1) * Clng(iPageSize)
    6 End If
    7 Rs.AbsolutePosition = (iPageIndex - 1) * iPageSize + 1

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

Grow your business fast with

Suku