文章内页类
程序员文章站
2022-07-02 07:54:55
复制代码 代码如下:<% class myarticle dim wenzhang_id &nbs...
复制代码 代码如下:
<%
class myarticle
dim wenzhang_id
dim title1,content1
private sub class_initialize()
'response.write "类的初始化 事件:class_initialize<br>"
end sub
private sub class_terminate()
'response.write "释放对象 事件:class_terminate<br>"
end sub
public property let id(byval v)
wenzhang_id = v
end property
public sub conn_sub()
set conn = server.createobject("adodb.connection")
cnnstr="driver={microsoft access driver (*.mdb)}; "
cnnstr=cnnstr & "dbq=" & server.mappath("admin/watavase/%29to-dream.mdb")
conn.open cnnstr
sql = "select * from article where deleted = 0 and articleid = "&wenzhang_id
set rs=server.createobject("adodb.recordset")
rs.open sql, conn, 1, 1
title1 = rs("title")
content1 = rs("content")
rs.close
set rs = nothing
conn.close
set conn = nothing
end sub
public property get title()
title = title1
end property
public property get content()
content = content1
end property
end class
'myarticle 类 使用说明
'dim wenzhang
'set wenzhang = new myarticle
'wenzhang.id = 3
'call wenzhang.conn_sub()
'response.write wenzhang.title
'response.write wenzhang.content
'set wenzhang = nothing
%>
上一篇: 一天开家长会