• 处理分页的数据函数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

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

  • 相关阅读:
    lnmp+memcache+tomcat
    redis的主从搭建
    curl只取状态码
    Tomcat的优化
    pip9 安装 centos6.8
    文件的下载
    保存图片到图库更新图库
    上传图片总结
    Android 大图片预览ViewPager
    Android 软件盘 Editext 问题
  • 原文地址:https://www.cnblogs.com/stronger/p/210149.html
Copyright © 2020-2023  润新知