文章内页类

2018-09-06 12:11

阅读:457

  复制代码 代码如下:
<%
classMyArticle
dimwenzhang_id
dimtitle1,content1
PrivateSubClass_Initialize()
response.Write类的初始化事件:Class_Initialize<br>
endsub

PrivateSubClass_Terminate()
response.Write释放对象事件:Class_Terminate<br>
endsub

PublicPropertyLetid(byvalv)
wenzhang_id=v
EndProperty

PublicSubconn_sub()
cnnstr=DRIVER={MicrosoftAccessDriver(*.mdb)};
cnnstr=cnnstr&DBQ=&Server.MapPath(admin/WataVase/%29to-dream.mdb)
conn.Opencnnstr

sql=Select*FromArticlewhereDeleted=0andArticleID=&wenzhang_id
setrs=Server.CreateObject(adodb.recordset)
rs.opensql,conn,1,1

title1=rs(Title)
content1=rs(Content)

rs.close
setrs=nothing

conn.close
setconn=nothing

endsub

PublicPropertyGettitle()
title=title1
EndProperty

PublicPropertyGetcontent()
content=content1
EndProperty

endclass

MyArticle类使用说明
dimwenzhang
setwenzhang=newMyArticle
wenzhang.id=3
callwenzhang.conn_sub()
response.writewenzhang.title
response.writewenzhang.content
setwenzhang=nothing
%>


评论


亲,登录后才可以留言!