-
Hi everybody ....
Is there any simple way (or a component in VB 6.0) to
browse the contain of microsoft access database
(tables and fields inside the tables) ?
Let's say I have:
test.mdb
table1
name text(20)
address text(20)
table2
mark number(3)
grade number(3)
When I select test.mdb, I would like to get the information
of table1 and table2 with all the fields inside.
Anyone can help me ? Any idea is appreciated.
Thanks
Keiko
-
Hi,
Do you mean viewing the structure of the .MDB and the tables?
Please Cleaify.
-
it depends, are you using ADO or DAO?
DAO:
have a look on tabledef in your help file
ADO:
have look on ADOX-library in help
best regards
Sascha
PS: if you need more info, contact me.
-
Lyla,
Yes viewing the structure of the .MDB file and tables.
(like in MS-SQL using sp_help)
Sascha,
Using ADO.
Any sample of codes ?
Thank you
Keiko ^_^
[Edited by Keiko on 04-29-2000 at 01:01 PM]
-
keiko,
here is a short example, that reads all field-names,
data-types+sizes and default values from all tables
of an Access-database:
good luck
sascha
'****************************************************
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
-
Thanks I'll try later.
Keiko
-
i forgot to mention that you have to reference the ADOX-library (Microsoft ADO Ext. 2.1 for DDL and Security) within your project. you need at least VB6 + SP3.
regards