PDA

Click to See Complete Forum and Search --> : Using the connection object to retrieve the tabledefs number


Piazza
Apr 28th, 2000, 02:15 AM
Hi!

Does anyone know how do I get the tabledefs number I have in a database?

When I used the DAO, a wrote:

...
For i = 1 To db.tabledefs.Count - 1
debug.print db.tabledefs(i).Name
Next
...

How do I do the same thing using the ADO Connection?

Or, if possible, using another ADO object?

Thanks a lot!!!
[]'s
Marcelo Piazza

Apr 30th, 2000, 07:28 AM
try somthing like this and don't forget to add a reference to ADOX (Microsoft ADO Ext. 2.1 for DDL and Security). you will need VB6 SP3.

***********************************************************

Dim x As New ADOX.Catalog
Dim t As New ADOX.Table
Dim c As New ADOX.Column

' Be sure to create your own Connection-object
Set x.ActiveConnection = GetConnection()

For Each t in x.Tables
Debug.Print t.Name
For Each c In t.Columns
Debug.Print c.Name & ", " & _
c.Type & ", " & _
c.DefinedSize & ", " & _
c.Properties("Default")
Next
Next

good luck

Piazza
May 19th, 2000, 01:06 AM
Thanks a lot, Sascha! It worked fine!

[]'s
Marcelo Piazza