代碼如下: <% '數據庫字段為類屬性,添加、刪除、修改、操作檢查等函數為類的方法 Class Cls_Leibie Private nClassID,sClassName,nParentID,sParentPath,nDepth,nRootID,nChild,nOrderID,sFilePath '定義私有變量(類的屬性,即數據庫字段對應的變量) Private rs,sql,ErrorStr
Private Sub Class_Initialize() ErrorStr="" '初始化錯誤信息為空 End Sub
Private Sub Class_Terminate() '銷毀類時關閉數據庫連接 If IsObject(Conn) Then Conn.Close Set Conn = Nothing End If End Sub
'*******************設置各個屬性****************************************************** Public Property Let ClassID(str) '獲取類別ID(主鍵) nClassID=str call ClassProperty() '獲取類別ID時調用此函數讀出類的所有屬性 End Property Public Property Let ClassName(str) '獲取類別名稱 sClassName=str End Property
Public Property Get ClassName ClassName=sClassName End Property
Public Property Let ParentID(str) '獲取類別父ID nParentID=str End Property
Public Property Get ParentID ParentID=nParentID End Property
Public Property Let ParentPath(str) '獲取父路徑ID sParentPath=str End Property
Public Property Get ParentPath ParentPath=sParentPath