ADOX.Catalog中文幫助詳細(xì)說明chm文檔第2/3頁
更新時間:2008年06月23日 19:50:47 作者:
這個是用來操作ACCESS數(shù)據(jù)庫的東西,遍歷表,遍歷表的所有字段及字段的屬性都會用到這個
2、ADOX 對象
Catalog 包含描述數(shù)據(jù)源模式目錄的集合。
Column 表示表、索引或關(guān)鍵字的列。
Group 表示在安全數(shù)據(jù)庫內(nèi)有訪問權(quán)限的組帳號。
Index 表示數(shù)據(jù)庫表中的索引。
Key 表示數(shù)據(jù)庫表中的主關(guān)鍵字、外部關(guān)鍵字或唯一關(guān)鍵字。
Procedure 表示存儲的過程。
Table 表示數(shù)據(jù)庫表,包括列、索引和關(guān)鍵字。
User 表示在安全數(shù)據(jù)庫內(nèi)具有訪問權(quán)限的用戶帳號。
View 表示記錄或虛擬表的過濾集。
3、ADOX 方法
Append(Columns) 將新的 Column 對象添加到 Columns 集合。
Append(Groups) 將新的 Group 對象添加到 Groups 集合。
Append(Indexes) 將新的 Index 對象添加到 Indexes 集合。
Append(Keys) 將新的 Key 對象添加到 Keys 集合。
Append(Procedures) 將新的 Procedure 對象添加到 Procedures 集合。
Append(Tables) 將新的 Table 對象添加到 Tables 集合。
Append(Users) 將新的 User 對象添加到 Users 集合。
Append(Views) 將新的 View 對象添加到 Views 集合。
ChangePassword 更改用戶帳號的密碼。
Create 創(chuàng)建新的目錄。
Delete 刪除集合中的對象。
GetObjectOwner 返回目錄中對象的擁有者。
GetPermissions 獲得對象上組或用戶的權(quán)限。
Item 按名稱或序號返回集合的指定成員。
Refresh 更新集合中的對象,以反映針對提供者可用的和指定的對象。
SetObjectOwner 指定目錄中對象的擁有者。
SetPermissions 設(shè)置對象上組或用戶的權(quán)限。
4、ADOX 屬性
ActiveConnection 指示目錄所屬的 ADO Connection 對象。
Attributes 描述列特性。
Clustered 指示索引是否被分簇。
Command 指定可用于創(chuàng)建或執(zhí)行過程的 ADO Command 對象。
Count 指示集合中的對象數(shù)量。
DateCreated 指示創(chuàng)建對象的日期。
DateModified 指示上一次更改對象的日期。
DefinedSize 指示列的規(guī)定最大大小。
DeleteRule 指示主關(guān)鍵字被刪除時將執(zhí)行的操作。
IndexNulls 指示在索引字段中有 Null 值的記錄是否有索引項。
Name 指示對象的名稱。
NumericScale 指示列中數(shù)值的范圍。
ParentCatalog 指定表或列的父目錄以便訪問特定提供者的屬性。
Precision 指示列中數(shù)據(jù)值的最高精度。
PrimaryKey 指示索引是否代表表的主關(guān)鍵字。
RelatedColumn 指示相關(guān)表中相關(guān)列的名稱(僅關(guān)鍵字列)。
RelatedTable 指示相關(guān)表的名稱。
SortOrder 指示列的排序順序(僅索引列)。
Type(列) 指示列的數(shù)據(jù)類型。
Type(關(guān)鍵字) 指示關(guān)鍵字的數(shù)據(jù)類型。
Type(表) 指示表的類型。
Unique 指示索引關(guān)鍵字是否必須是唯一的。
UpdateRule 指示主關(guān)鍵字被更新時會執(zhí)行的操作。
5、范例
一、創(chuàng)建數(shù)據(jù)庫范例
如下代碼顯示如何通過 Create 方法創(chuàng)建新的 Jet 數(shù)據(jù)庫。
ASP代碼:
-----------------------------------------------------------
set cat=server.createobject("ADOX.Catalog")
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\new.mdb"
VB代碼
--------------------------------
Sub CreateDatabase()
'Dim cat As New ADOX.Catalog
' cat.Create ""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\new.mdb""
End Sub
二、創(chuàng)建表范例ASP代碼:
-------------<%
set cat=server.createobject("ADOX.Catalog")
dbpath=server.mappath("/shit/date/new.mdb") cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&dbpath
set tbl=Server.createobject("ADOX.Table")
tbl.Name = "MyTable"
tbl.Columns.Append "Column1", 3 'adInteger
tbl.Columns.Append "Column2", 3 'adInteger
tbl.Columns.Append "Column3", 202 ,50 'adVarWChar
cat.Tables.Append tbl
%>
VB代碼:---------------
Sub CreateTable()
Dim tbl As New Table
Dim cat As New ADOX.Catalog
'打開目錄。
' 打開目錄。
cat.ActiveConnection = _
""Provider=Microsoft.Jet.OLEDB.4.0;"" & _
""Data Source=c:\Program Files\Microsoft Office\"" & _
""Office\Samples\Northwind.mdb;""
tbl.Name = ""MyTable""
tbl.Columns.Append ""Column1"", adInteger
tbl.Columns.Append ""Column2"", adInteger
tbl.Columns.Append ""Column3"", adVarWChar, 50
cat.Tables.Append tbl
End Sub
相關(guān)文章
用VBS修改遠(yuǎn)程桌面3389端口并添加到Windows防火墻的代碼
用vbs實現(xiàn)端口就是用vbs修改的注冊表,主要是vbs的添加到防火墻的代碼,值得大家學(xué)習(xí)2008-06-06VBS ArrayList Class vbs中的數(shù)組類
VBS ArrayList Class vbs中的數(shù)組類...2007-03-03