I found an old thread that had never been answered here - http://www.daniweb.com/software-development/vbnet/threads/330981
Basically, the guy was asking how to retrieve database names and/or table names from a MySql database with vb.net. Here's my answer to that. Yes, I still use vb6 because vb.net is not much better and I can do anything I need to in vb6. This function is from a production program I wrote a while back.
I looked all over Google to see if I could find a better way to do it but the examples I found were 'college level' and not real world code, so I wrote my own. This function returns a recordset just like any other recordset. Once you get the DB Names you can do whatever you want.
I haven't defined everything here .. the code calls external functions that open or close a connection and the ADODB and ADO recordset are defined elsewhere. But if you work with Visual Basic you should already know how to set up an ADO Connection and recordset. If not, ask your professor. He'll send you to Microsoft's website so you can look it up. *grin*
To see tablenames set the sql to - sql = "show tables in " & dbname & ";"
where dbname is the name of the database to enumerate.
Want to see the field names too?
set sql to - sql = "show columns from " & tbl & " in " & dbname & ";"
where tbl is the tablename and dbname is the database name
If you use this function in a production program, please give me credit for originating it.
And, if this helps you get past a problem, great. If not, here it is anyway.