To get the list of tables, you need to be connected to a database, to get the
list of fields, you need a reference to a table. I am not sure how you will
get a list of databases without a connection; to get a connection you need a
specific database.
If you were using SQL Server, you could use the SQLDMO object; but that does
not work with other databases.
Assuming you have a connection to a database, you can get a list of tables
(and their types) and for each table the fields and their types using the
ADOX.Catalog object.
Set xx=CreateObject("ADOX.Catalog")
xx.ActiveConnection = {whatever that is for mysql}
for each table in xx.Tables
debug.print table.Name
for each fld in table.Fields
debug.print fld.name ' fld.Type
next
next
"Snowy" wrote:
> Hello All.
>
> I have three combo box on my vb form namely.
> 1. cmbDatabases.
> 2. cmbTables.
> 3. cmbFields.
>
> I have connected to mysql through ADODB.
> Their are above 100 databases in mysql.
> What i want is to show these databases names in 1st combo box i.e.
> cmbDatabases then
> show table names from selected database in 2nd combo box i.e. cmbTables
> and then show related fields from tables in 3rd combo box i.e
> cmbfields.
>
> can anyone tell me how to fetch databases name, related tables & fields
> in combo box.
>
> Thanks
> Snowy
>
>
|