查询翻页优化第1/2页

2019-01-14 07:28:05丽君

    '//定义需要输出的字段名
    Public Property Let Fields(s)
        sFields = s
    End Property

    '//定义主键
    Public Property Let Pkey(s)
        sPkey = s
    End Property

    '//定义排序规则
    Public Property Let OrderBy(s)
        sOrderBy = " ORDER BY " & s & " "
    End Property

    '//定义每页的记录条数 
    Public Property Let PageSize(s)
        iPageSize = s
        If Not isNumeric(iPageSize) Then iPageSize = iDefaultPageSize
        If CLng(iPageSize)<1 Then iPageSize = iDefaultPageSize
    End Property

    '//定义当前页码
    Public Property Let Page(s)
        iPage = s
        If Not isNumeric(iPage) Then iPage = 1
        If CLng(iPage)<1 Then iPage = 1
        Call CaculatePageCount()
        If CLng(iPage)>CLng(iPageCount) And iPageCount>0 Then iPage = iPageCount
    End Property

    '//自定义查询语句
    Public Property Let Sql(s)
        sSqlString = s
    End Property

    '//-------------------- 输出属性 --------------------//'
    '//取得当前条件下的记录数
    Public Property Get RecordCount
        If isNull(iRecCount) Then CaculateRecCount()
        RecordCount = iRecCount
    End Property

    '//取得当前页码
    Public Property Get Page
        Page = iPage
    End Property

    '//取得当前页码
    Public Property Get AbsolutePage
        AbsolutePage = iPage
    End Property