|
-
March 20th, 2001, 04:53 PM
#1
Tables Count
hi,
Is there any Tables Collection in ADO?
i need to count the tables in my database and listing them, so my users can edit any table without me to write special procedure to do that.
10x.
Daniel Prinz
-
March 20th, 2001, 10:28 PM
#2
Re: Tables Count
Yep,
There are a couple of ways to do this.
1. Include a reference to MSADOX.dll (Microsoft ADO Ext) and use the Catalog class
2. In ADO Connection class, there is a function OpenSchema where you can specify the schema type to open and this is returned in an ADO recordset. Check out the help on this for the column names that store the table details.
Thanx
Andrew
-
March 21st, 2001, 08:41 AM
#3
Re: Tables Count
Sub ListTables()
Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
'References : Microsoft ADO Ext 2.1 or DDL and Security
' Open the catalog
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\nwind.mdb;"
' Loop through the tables in the database and print their name
For Each tbl In cat.Tables
If tbl.Type <> "VIEW" Then List1.AddItem tbl.Name
'not to see system tables If Left$(tbl.Name, 4) <> "MSys" Then List1.AddItem tbl.Name
Next
End Sub
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|