28,404
社区成员
发帖
与我相关
我的任务
分享
<%
'代码编写:Never
'QQ:286895485
'更新时间:2010-6-30
'功能:公用数据表模型
Class Model
'私有变量
private TableName_ '表名
private Feilds_ '字段列表
private Where_ '条件
private OrderBy_ '排序
private Cols_ '可带值的字段
Private PageString_ '分页连接参数
'公用变量
Public PageSize '页大小
Public CurrentPage '当前页
Public TopNum '指定条数的数据
Public IDs 'ID列表
Public AllNumber '记录总数
Public AllPages '总页数
Public PageBar '分页其它参数
Private Sub Class_Initialize
Set Cols_=Server.CreateObject("scripting.dictionary")
'默认属性
Feilds_="*"
Where_=""
OrderBy_="id desc"
PageString_="CurrengPage"
PageSize=20
CurrentPage=Request.QueryString(PageString_)
End Sub
'获取或设置表名
Public property let TableName(value)
TableName_=value
End property
Public property get TableName()
TableName=TableName_
End property
'获取或设置字段列表
Public property let Feilds(value)
Feilds_=value
End property
Public property get Feilds()
Feilds=Feilds_
End property
'获取或设置条件
Public property let Where(value)
Where_=value
End property
Public property get Where()
Where=Where_
End property
'获取或者设置排序
Public property let OrderBy(value)
OrderBy_=value
End property
Public property get OrderBy()
OrderBy=OrderBy_
End property
'获取或设置分页参数
Public property let PageString(value)
PageString_=value
CurrentPage=Request.QueryString(PageString_)
End property
Public property get PageString()
PageString=PageString_
End property
'获取字段键值对列表
Public Property get Cols()
Set Cols=Cols_
End property
'添加列数据
'cValue:传入字符串则直接自动加"'"
'Ex:M.ColsAdd "UserType",1;M.ColsAdd "UserName","zhang"
Function Add(cName,cValue)
IF TypeName(cValue)<>"Integer" And TypeName(cValue)<>"Double" Then
cValue="'"&cValue&"'"
End IF
Cols_.add cName,cValue
End Function
'清除指定的字段
Function Remove(key)
Cols_.Remove(key)
End Function
'清除所有字段
Function RemoveAll()
Cols_.RemoveAll()
End Function
'释放对像
Private Sub class_terminate()
set Cols_=Nothing
End Sub
End Class
%>