ADOX

Catalog ActiveConnection Property Example (VB)

Setting the ActiveConnection property to a valid, open connection "opens" the catalog. From an open catalog, you can access the schema objects contained within that catalog.

<"C:\MDAC SDK 2.6\ADO\Source\ADOCore\Code\VB\Catalog.bas" BeginOpenConnectionVB,EndOpenConnectionVB>

Setting the ActiveConnection property to a valid connection string also "opens" the catalog.

' BeginOpenConnection2VB
Sub OpenConnectionWithString()

   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;"
   Debug.Print cat.Tables(0).Type

End Sub
' EndOpenConnection2VB

See Also

ActiveConnection Property | Catalog Object | Table Object | Tables Collection | Type Property (Table)