复制代码 代码如下:
<%
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()
Setconn=Server.createObject("ADODB.Connection")
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
%>