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

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

  • 相关阅读:
    # MYSQL 8.0 远程 clone
    MySQL-07-备份恢复
    迁移表空间
    2. MYSQL 数据库的介绍安装
    Percona Xrabackup 应用
    4.2.5 案例:通过mysqldump全备+binlog实现PIT数据恢复
    Mysql Innodb 表碎片整理
    关于_vsnprintf
    算法:华为面试代码题
    platform设备驱动框架
  • 原文地址:https://www.cnblogs.com/stronger/p/210149.html
Copyright © 2011-2022 走看看