ADOX 2.5 API 参考 | |
© 1998-2003 Microsoft Corporation。保留所有权利。 ADOX 2.5 | |
DateCreated 和 DateModified 属性范例 (VB)本范例通过向现有的 Table 中添加新的 Column 以及创建新的 Table 来演示 DateCreated 和 DateModified 属性。运行本范例需要 DateOutput 过程。 ' BeginDateCreatedVBSub Main() On Error GoTo DateCreatedXError Dim cat As New ADOX.Catalog Dim tblEmployees As ADOX.Table Dim tblNewTable As ADOX.Table ' Connect the catalog. cat.ActiveConnection = "Provider='Microsoft.Jet.OLEDB.4.0';" & _ "Data Source='c:\Program Files\" & _ "Microsoft Office\Office\Samples\Northwind.mdb';" With cat Set tblEmployees = .Tables("Employees") ' Print current information about the Employees table. DateOutput "Current properties", tblEmployees ' Create and append column to the Employees table. tblEmployees.Columns.Append "NewColumn", adInteger .Tables.Refresh ' Print new information about the Employees table. DateOutput "After creating a new column", tblEmployees ' Delete new column because this is a demonstration. tblEmployees.Columns.Delete "NewColumn" ' Create and append new Table object to the Northwind database. Set tblNewTable = New ADOX.Table tblNewTable.Name = "NewTable" tblNewTable.Columns.Append "NewColumn", adInteger .Tables.Append tblNewTable .Tables.Refresh ' Print information about the new Table object. DateOutput "After creating a new table", .Tables("NewTable") ' Delete new Table object because this is a demonstration. .Tables.Delete tblNewTable.Name End With 'Clean up Set cat.ActiveConnection = Nothing Set cat = Nothing Exit Sub DateCreatedXError: Set cat = Nothing If Err <> 0 Then MsgBox Err.Source & "-->" & Err.Description, , "Error" End IfEnd SubSub DateOutput(strTemp As String, tblTemp As ADOX.Table) ' Print DateCreated and DateModified information about ' specified Table object. Debug.Print strTemp Debug.Print " Table: " & tblTemp.Name Debug.Print " DateCreated = " & tblTemp.DateCreated Debug.Print " DateModified = " & tblTemp.DateModified Debug.PrintEnd Sub' EndDateCreatedVB 请参阅DateCreated 属性 | DateModified 属性 | Procedure 对象 | Procedures 集合 | View 对象 | Views 集合 © 1998-2003 Microsoft Corporation。保留所有权利。 |