zoukankan      html  css  js  c++  java
  • 处理分页的数据函数GetlistByPage(strSQL, PageSize, PageNo, PageCount, arrList)

    '-------------------------------------------
    'strSQL:标准的SQL语句
    'PageSize:每页的纪录数
    'PageNo:第几页
    'PageCount:总页数
    'arrList:存放数据的二维数组
    '------------------------------------------
    Function GetListByPage(strSQL, PageSize, PageNo, PageCount, arrList)
        On Error Resume Next
        Dim objConn, objRS
            
        Set objConn = Server.CreateObject("ADODB.Connection")
        objConn.Open Application("connstr")  'Application("connstr") 为数据库连接字符串
        Set objRS = Server.CreateObject("ADODB.RecordSet")
        GetListByPage= False
          
        objRS.Open strSQL, objConn, 1, 1
        If Not objRS.eof And Not objRS.bof Then
           objRS.PageSize = Int(PageSize)
           PageCount = objRS.PageCount
           if PageNo < 0 then PageNo = 1
           if int(PageNo) > int(PageCount) then PageNo = PageCount
              objRS.AbsolutePage = PageNo
              arrList=objRS.GetRows(PageSize)
              GetListByPage= True
           else
              PageCount = 0
        end if
        objRS.Close
        Set objRS = nothing
        objConn.close
        Set objConn = Nothing
       
        if err.Number > 0 then GetListByPage= False
    End Function

    下一篇介绍与该函数紧密配合的分页函数

  • 相关阅读:
    周五,远程连接及总体流程
    C++ 图片浏览
    深度解析Java内存的原型
    找不到class
    js读写cookie
    不利用临时变量,交换两个变量的值
    插入排序
    算法:一个排序(第一个最大,第二个最小,第三个其次大,第四其次小...)
    c#缓存介绍(1)
    JavaScript中创建自定义对象
  • 原文地址:https://www.cnblogs.com/stronger/p/210149.html
Copyright © 2011-2022 走看看