当前位置: 移动技术网 > IT编程>开发语言>Asp > 文章内页类

文章内页类

2017年12月12日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:

<%
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
%>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网