欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

一個ACCESS數(shù)據(jù)庫訪問的類第3/3頁

 更新時間:2006年07月09日 00:00:00   作者:  

還有一個讀取XML的類 XmlReader:
<%
Class XmlReader Private Xml Public Sub Load(ByVal Path)
Xml.Load(Server.MapPath(Path))
End Sub Public Function SelectSingleNode(ByVal XPath)
Set SelectSingleNode = Xml.SelectSingleNode(XPath)
End Function Public Function SelectNodes(ByVal XPath)
Set SelectNodes = Xml.SelectNodes(XPath)
End Function

Private Sub Class_initialize()
Set Xml = Server.CreateObject("Microsoft.XMLDOM")
Xml.async = False
'Xml.setProperty "ServerHTTPRequest", True
End Sub
Private Sub Class_Terminate()
Set Xml = Nothing
End Sub End Class
%>

好了,萬事俱備,開始搭建基本的三層:
數(shù)據(jù)模型層:此層對應成一個類,類的類名和字段屬性對應于數(shù)據(jù)庫的相應表名及字段。
考慮表News,其結構如下:


則其對應的模型層如下:
<%
Class DataNews Private IAddDate
Private IContent
Private ICount
Private INewsID
Private ITitle
Private IUserID
Private IUserName Public Property Let AddDate(ByVal Value)
IAddDate = Value
End Property
Public Property Get AddDate()
AddDate = IAddDate
End Property Public Property Let Content(ByVal Value)
IContent = Value
End Property
Public Property Get Content()
Content = IContent
End Property Public Property Let Count(ByVal Value)
ICount = Value
End Property
Public Property Get Count()
Count = ICount
End Property Public Property Let NewsID(ByVal Value)
INewsID = Value
End Property
Public Property Get NewsID()
NewsID = INewsID
End Property Public Property Let Title(ByVal Value)
ITitle = Value
End Property
Public Property Get Title()
Title = ITitle
End Property Public Property Let UserID(ByVal Value)
IUserID = Value
End Property
Public Property Get UserID()
UserID = IUserID
End Property Public Property Let UserName(ByVal Value)
IUserName = Value
End Property
Public Property Get UserName()
UserName = IUserName
End Property Private Sub Class_initialize()
End Sub
Private Sub Class_Terminate()
End Sub End Class
%>

這里用了類名DataNews,因為VBScript不支持Namespace(-_-),以前綴區(qū)分,而類中私有屬性用I作前綴,沒什么特別含義,僅僅是因為I所占寬度較小,不影響理解時的聯(lián)想反應速度,如果非要拉點合理的解釋的話,那么就是,Private中的I,以區(qū)分于Public,不用m_之類,是因為覺得它不夠美觀,影響編碼心情(所以不喜歡寫C),因為需要以優(yōu)雅之心情,編寫優(yōu)雅的代碼(哎呀,誰扔的雞蛋?拜托換個新鮮點的)。
  • CacheCls緩存的應用

    CacheCls緩存的應用

    CacheCls緩存的應用...
    2006-08-08
  • 分頁類,異常類

    分頁類,異常類

    分頁類,異常類...
    2006-07-07
  • cls_main.asp

    cls_main.asp

    cls_main.asp...
    2006-10-10
  • Access 2000 數(shù)據(jù)庫 80 萬記錄通用快速分頁類

    Access 2000 數(shù)據(jù)庫 80 萬記錄通用快速分頁類

    Access 2000 數(shù)據(jù)庫 80 萬記錄通用快速分頁類...
    2007-03-03
  • ASP中一個用VBScript寫的隨機數(shù)類

    ASP中一個用VBScript寫的隨機數(shù)類

    ASP中一個用VBScript寫的隨機數(shù)類...
    2006-08-08
  • asp分頁的一個類

    asp分頁的一個類

    asp分頁的一個類...
    2007-03-03
  • ASP怎么談到應用到類的?

    ASP怎么談到應用到類的?

    ASP怎么談到應用到類的?...
    2006-09-09
  • 淺談ASP中的類

    淺談ASP中的類

    淺談ASP中的類...
    2006-08-08
  • 一個asp快速字符串連接類

    一個asp快速字符串連接類

    一個asp快速字符串連接類...
    2006-08-08
  • 最新評論