Thursday, July 9, 2009

Using c#, how do I get a list of available databases on a mySql server?

I am using an Odbc connection and I can connect and interact with the server fine. I have been completely unable to find how to get a list of the available databases. the GetSchema function is only returning "views" as a result. Does anyone have any idea?


Exmple:


OdbcConnection c = new ......


c.GetSchema(); %26lt;- returns only "views"


c.GetSchema("Databases"); %26lt;- returns "Collection is not defined"





I realize that I could do this more easily with SQL server, but I really would like to do this using MySql.

Using c#, how do I get a list of available databases on a mySql server?
The easiest way is to call the system stored procedure "sp_databases" and read the result it returns.


No comments:

Post a Comment