查询翻页优化第1/2页(4)


                & " )" _
                & " " & sOrderBy & " "
    End Function

    '//产生条件字符串
    Private Sub makeCondition()
        If UBound(aCondition)>=0 Then
            sCondition = " WHERE " & Join(aCondition, " AND ")
        End If
    End Sub

    '//计算总记录数(带条件)
    Private Sub CaculateRecCount()
        On Error Resume Next
        Dim oRs
        Call makeCondition()
        Set oRs = oConn.Execute( "SELECT COUNT(["&sPKey&"]) FROM [" & sTableName & "]" & sCondition )
        If Err Then
            doError Err.Description
            Response.End()
        End If
        iRecCount = oRs.Fields.Item(0).Value
        Set oRs = Nothing
    End Sub

    '//计算总记录数(不带条件)
    Private Sub CaculateTotalRecCount()
        On Error Resume Next
        Dim oRs
        Set oRs = oConn.Execute( "SELECT COUNT(["&sPKey&"]) FROM [" & sTableName & "]" )
        If Err Then
            doError Err.Description
            Response.End()
        End If
        iTotalRecCount = oRs.Fields.Item(0).Value
        Set oRs = Nothing
    End Sub

    '//计算页数
    Private Sub CaculatePageCount()

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3577.html