Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleUse ADOX to get lots of information about an Access database
DescriptionThis example shows how to use ADOX to get lots of information about an Access database in Visual Basic 6.
KeywordsADOX, information, database, Access
CategoriesDatabase
 
Thanks to James Hansen.

This example creates an ADOX.Catalog object representing a database and uses its properties to get information about the database.

 
Private Function GetADOInfo(Optional ByVal DBPath As _
    String) As String
   Dim txt As String
   Dim iCatalog As Object
   Set iCatalog = CreateObject("ADOX.Catalog")

   '------------------------------------------
   On Error Resume Next
   If Not (FileLen(DBPath) > 0) Then
      'Create a Blank DB.
      'iCatalog.Create
      ' "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" &
      ' DBPath
      iCatalog.Create _
          "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
          DBPath
   Else
      iCatalog.ActiveConnection = _
          "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " _
          & DBPath
   End If
   Err.Clear
   '------------------------------------------

   With iCatalog.ActiveConnection
      txt = txt & vbCrLf & "ADO Version: " & .Version
      txt = txt & vbCrLf & "DBMS Name: " & _
          .Properties("DBMS Name")
      txt = txt & vbCrLf & "DBMS Version: " & _
          .Properties("DBMS Version")
      txt = txt & vbCrLf & "OLE DB Version: " & _
          .Properties("OLE DB Version")
      txt = txt & vbCrLf & "Provider Name: " & _
          .Properties("Provider Name")
      txt = txt & vbCrLf & "Provider Version: " & _
          .Properties("Provider Version")
      txt = txt & vbCrLf & vbCrLf
      txt = txt & vbCrLf & "Driver Name: " & _
          .Properties("Driver Name")
      txt = txt & vbCrLf & "Driver Version: " & _
          .Properties("Driver Version")
      txt = txt & vbCrLf & "Driver ODBC Version: " & _
          .Properties("Driver ODBC Version")
      txt = txt & vbCrLf & vbCrLf
      txt = txt & vbCrLf & "Current Catalog: " & _
          .Properties("Current Catalog")
      txt = txt & vbCrLf & "Reset DataSource: " & _
          .Properties("Reset DataSource")
      txt = txt & vbCrLf & "Active Sessions: " & _
          .Properties("Active Sessions")
      txt = txt & vbCrLf & "Asynchable Commit: " & _
          .Properties("Asynchable Commit")
      txt = txt & vbCrLf & "Catalog Location: " & _
          .Properties("Catalog Location")
      txt = txt & vbCrLf & "Catalog Term: " & _
          .Properties("Catalog Term")
      txt = txt & vbCrLf & "Catalog Usage: " & _
          .Properties("Catalog Usage")
      txt = txt & vbCrLf & "Column definition: " & _
          .Properties("Column definition")
      txt = txt & vbCrLf & "NULL Concatenation Behavior: " _
          & .Properties("NULL Concatenation Behavior")
      txt = txt & vbCrLf & "Data Source Name: " & _
          .Properties("Data Source Name")
      txt = txt & vbCrLf & "Read-Only Data Source: " & _
          .Properties("Read-Only Data Source")
      txt = txt & vbCrLf & "DBMS Name: " & _
          .Properties("DBMS Name")
      txt = txt & vbCrLf & "DBMS Version: " & _
          .Properties("DBMS Version")
      txt = txt & vbCrLf & "GROUP BY Support: " & _
          .Properties("GROUP BY Support")
      txt = txt & vbCrLf & "Heterogeneous Table Support: " _
          & .Properties("Heterogeneous Table Support")
      txt = txt & vbCrLf & "Identifier Case Sensitivity: " _
          & .Properties("Identifier Case Sensitivity")
      txt = txt & vbCrLf & "Maximum Index Size: " & _
          .Properties("Maximum Index Size")
      txt = txt & vbCrLf & "Maximum Row Size: " & _
          .Properties("Maximum Row Size")
      txt = txt & vbCrLf & "Maximum Row Size Includes BLOB: " & _
          "" & .Properties("Maximum Row Size Includes BLOB")
      txt = txt & vbCrLf & "Maximum Tables in SELECT: " & _
          .Properties("Maximum Tables in SELECT")
      txt = txt & vbCrLf & "Multiple Storage Objects: " & _
          .Properties("Multiple Storage Objects")
      txt = txt & vbCrLf & "Multi-Table Update: " & _
          .Properties("Multi-Table Update")
      txt = txt & vbCrLf & "NULL Collation Order: " & _
          .Properties("NULL Collation Order")
      txt = txt & vbCrLf & "OLE Object Support: " & _
          .Properties("OLE Object Support")
      txt = txt & vbCrLf & "ORDER BY Columns in Select " & _
          "List: " & .Properties("ORDER BY Columns in " & _
          "Select List")
      txt = txt & vbCrLf & "Prepare Abort Behavior: " & _
          .Properties("Prepare Abort Behavior")
      txt = txt & vbCrLf & "Prepare Commit Behavior: " & _
          .Properties("Prepare Commit Behavior")
      txt = txt & vbCrLf & "Procedure Term: " & _
          .Properties("Procedure Term")
      txt = txt & vbCrLf & "Provider Name: " & _
          .Properties("Provider Name")
      txt = txt & vbCrLf & "OLE DB Version: " & _
          .Properties("OLE DB Version")
      txt = txt & vbCrLf & "Provider Version: " & _
          .Properties("Provider Version")
      txt = txt & vbCrLf & "Quoted Identifier Sensitivity: " & _
          "" & .Properties("Quoted Identifier Sensitivity")
      txt = txt & vbCrLf & "Schema Term: " & _
          .Properties("Schema Term")
      txt = txt & vbCrLf & "Schema Usage: " & _
          .Properties("Schema Usage")
      txt = txt & vbCrLf & "SQL Support: " & _
          .Properties("SQL Support")
      txt = txt & vbCrLf & "Structured Storage: " & _
          .Properties("Structured Storage")
      txt = txt & vbCrLf & "Subquery Support: " & _
          .Properties("Subquery Support")
      txt = txt & vbCrLf & "Isolation Levels: " & _
          .Properties("Isolation Levels")
      txt = txt & vbCrLf & "Isolation Retention: " & _
          .Properties("Isolation Retention")
      txt = txt & vbCrLf & "Table Term: " & _
          .Properties("Table Term")
      txt = txt & vbCrLf & "User Name: " & _
          .Properties("User Name")
      txt = txt & vbCrLf & "Pass By Ref Accessors: " & _
          .Properties("Pass By Ref Accessors")
      txt = txt & vbCrLf & "Transaction DDL: " & _
          .Properties("Transaction DDL")
      txt = txt & vbCrLf & "Asynchable abort: " & _
          .Properties("Asynchable abort")
      txt = txt & vbCrLf & "Data Source Object Threading " & _
          "Model: " & .Properties("Data Source Object " & _
          "Threading Model")
      txt = txt & vbCrLf & "Output Parameter Availability: " & _
          "" & .Properties("Output Parameter Availability")
      txt = txt & vbCrLf & "Persistent ID Type: " & _
          .Properties("Persistent ID Type")
      txt = txt & vbCrLf & "Multiple Parameter Sets: " & _
          .Properties("Multiple Parameter Sets")
      txt = txt & vbCrLf & "Rowset Conversions on Command: " & _
          "" & .Properties("Rowset Conversions on Command")
      txt = txt & vbCrLf & "Multiple Results: " & _
          .Properties("Multiple Results")
      txt = txt & vbCrLf & "Provider Friendly Name: " & _
          .Properties("Provider Friendly Name")
      txt = txt & vbCrLf & "Connection Status: " & _
          .Properties("Connection Status")
      txt = txt & vbCrLf & "Server Name: " & _
          .Properties("Server Name")
      txt = txt & vbCrLf & "Open Rowset Support: " & _
          .Properties("Open Rowset Support")
      txt = txt & vbCrLf & "Accessible Procedures: " & _
          .Properties("Accessible Procedures")
      txt = txt & vbCrLf & "Accessible Tables: " & _
          .Properties("Accessible Tables")
      txt = txt & vbCrLf & "Integrity Enhancement Facility: " & _
          "" & .Properties("Integrity Enhancement Facility")
      txt = txt & vbCrLf & "Outer Join Capabilities: " & _
          .Properties("Outer Join Capabilities")
      txt = txt & vbCrLf & "Stored Procedures: " & _
          .Properties("Stored Procedures")
      txt = txt & vbCrLf & "Driver Name: " & _
          .Properties("Driver Name")
      txt = txt & vbCrLf & "Driver Version: " & _
          .Properties("Driver Version")
      txt = txt & vbCrLf & "Driver ODBC Version: " & _
          .Properties("Driver ODBC Version")
      txt = txt & vbCrLf & "Like Escape Clause: " & _
          .Properties("Like Escape Clause")
      txt = txt & vbCrLf & "Special characters: " & _
          .Properties("Special characters")
      txt = txt & vbCrLf & "Max Columns in Group By: " & _
          .Properties("Max Columns in Group By")
      txt = txt & vbCrLf & "Max Columns in Index: " & _
          .Properties("Max Columns in Index")
      txt = txt & vbCrLf & "Max Columns in Order By: " & _
          .Properties("Max Columns in Order By")
      txt = txt & vbCrLf & "Max Columns in Select: " & _
          .Properties("Max Columns in Select")
      txt = txt & vbCrLf & "Max Columns in Table: " & _
          .Properties("Max Columns in Table")
      txt = txt & vbCrLf & "Numeric Functions: " & _
          .Properties("Numeric Functions")
      txt = txt & vbCrLf & "SQL Grammar Support: " & _
          .Properties("SQL Grammar Support")
      txt = txt & vbCrLf & "Outer Joins: " & _
          .Properties("Outer Joins")
      txt = txt & vbCrLf & "String Functions: " & _
          .Properties("String Functions")
      txt = txt & vbCrLf & "System Functions: " & _
          .Properties("System Functions")
      txt = txt & vbCrLf & "Time/Date Functions: " & _
          .Properties("Time/Date Functions")
      txt = txt & vbCrLf & "File Usage: " & _
          .Properties("File Usage")
      txt = txt & vbCrLf & "Active Statements: " & _
          .Properties("Active Statements")
      txt = txt & vbCrLf & "Password: " & _
          .Properties("Password")
      txt = txt & vbCrLf & "Persist Security Info: " & _
          .Properties("Persist Security Info")
      txt = txt & vbCrLf & "User id: " & .Properties("User " & _
          "id")
      txt = txt & vbCrLf & "Data Source: " & _
          .Properties("Data Source")
      txt = txt & vbCrLf & "Window Handle: " & _
          .Properties("Window Handle")
      txt = txt & vbCrLf & "Location: " & _
          .Properties("Location")
      txt = txt & vbCrLf & "Mode: " & .Properties("Mode")
      txt = txt & vbCrLf & "Prompt: " & _
          .Properties("Prompt")
      txt = txt & vbCrLf & "Connect Timeout: " & _
          .Properties("Connect Timeout")
      txt = txt & vbCrLf & "Extended Properties: " & _
          .Properties("Extended Properties")
      txt = txt & vbCrLf & "Locale Identifier: " & _
          .Properties("Locale Identifier")
      txt = txt & vbCrLf & "Initial Catalog: " & _
          .Properties("Initial Catalog")
      txt = txt & vbCrLf & "OLE DB Services: " & _
          .Properties("OLE DB Services")
      txt = txt & vbCrLf & "General Timeout: " & _
          .Properties("General Timeout")
      txt = txt & vbCrLf & "Autocommit Isolation Levels: " _
          & .Properties("Autocommit Isolation Levels")
   End With

   GetADOInfo = Mid$(txt, 1 + Len(vbCrLf))
End Function
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated