Copy Code code as follows:
<%
Class Myarticle
Dim wenzhang_id
Dim title1,content1
Private Sub Class_Initialize ()
' Response. Write "Class initialization event:class_initialize<br>"
End Sub
Private Sub Class_Terminate ()
' Response. Write "Release object event: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 class usage instructions
' Dim Wenzhang
' Set Wenzhang = new Myarticle
' Wenzhang.id = 3
' Call Wenzhang.conn_sub ()
' Response.Write Wenzhang.title
' Response.Write wenzhang.content
' Set Wenzhang = Nothing
%>