创建表范例

目录

如下代码演示如何创建新表。

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 tblEnd Sub
www.holmesian.org