继上传类之后找到分页类
Asp 分页类
在目前简陋的系统中,有点难度的应该就是这两点了。上传文件作为一大专题,不但有各种组件可以选择使用,还有各种性能各异的类。分页相对来说就注意得少一些,我想毕竟它相对来说可能是比较普遍并且容易实现的功能,另一方面它又是相对来说需要实现的功能不怎么集中,表现形式比较多,要统一用类来提供比较困难。
然而分页类还是有,并且还有不少。blueidea上提供的一个类下载下来竟然经常提示找不到记录集,再找到另外一个,使用简单方便了许多,觉得可以满足一般需要,贴出来共享。
<!--#include file="conn.asp"-->
<%
'==========================================================
'== Cls_Paginate的使用方法 ==
'== 属性: ==
'== SQL: 要查询的SQL语句 ==
'== pageSize: 每页面要显示的记录数 ==
'== page: 显示每page页 ==
'== BgColor: 要显示的表头颜色 ==
'== TableHeader: 表头要显示的自定义字段 ==
'== FlagID: 标识行的字段名 ==
'== disposeFile: 处理记录的文件名 ==
'== tableWidth: 要显示的表格宽度 ==
'== 方法: ==
'== ConnectDB(connFlag): 连接到数据库 ==
'== showSQL(): 显示要执行查询SQL语句 ==
'== showPage():显示一页码 ==
'== GetQueryCount(): 返回查询数据库次数 ==
'== getUrl(): 得到当前页面的地址 ==
'==========================================================
Class Cls_ShowPage
Private strSQL,oldStrSQL
Private oConn,rs
Private showPageSize,showCurrentPage
Private QueryCount
Private isRsEmpty,starTime,endTime,strBgColor,strID,strFile,strMouseOverColor,strWidth
Private strTableHeader
'=================================================
'类初始化
'=================================================
Private Sub Class_Initialize
If NOt IsObject(rs) then
set rs=Server.CreateObject("ADODB.RecordSet")
End If
'默认每页显示10条记录
showPageSize=15
'默认显示第1页
showCurrentPage=1
'默认sql语句为空
strSQLFlag=""
oldStrSQL=""
'默认查询数据库次数为0
QueryCount=0
'默认Recordset为空,不为空时值False,为空时True
isRsEmpty=True
'默认将字段名显示在表头
strTableHeader=""
'默认表头颜色
strBgColor="#A3A7E0"
'创建类的初始时间
starTime=timer()
'鼠标经过表格行时的颜色
strMouseOverColor="#D0D0D0"
'默认显示表格宽度
strWidth="100%"
End Sub
'=================================================
'连接数据库
'=================================================
Public Sub connectDB(ByVal ObjConn)
if not IsObject(objConn) then
response.write "<br>数据库连接出错,请检查...<br>"
Else
oConn=objConn
End If
End Sub
'==================================================
'给出表头颜色
'==================================================
Public Property Let BgColor(ByVal str_BgColor)
strBgColor=str_BgColor
End Property
'==================================================
'得到要显示的表格宽度
'==================================================
Public Property Let tableWidth(ByVal str_Width)
strWidth=str_Width
End Property
'==================================================
'鼠标经过行时的颜色
'==================================================
Public Property Let MouseOvrColor(ByVal str_OverColor)
strMouseOverColor=str_OverColor
End Property
'=================================================
'得到strSQL赋值
'=================================================
Public Property Let SQL(ByVal str_SQL)
strSQL=str_SQL
End Property
'=================================================
'得到页面显示记录个数
'=================================================
Public Property Let pageSize(ByVal str_pageSize)
showPageSize=cInt(str_pageSize)
End Property
'===============================================