Connect to Mysql from a Windows Application using ODBC

1. Download the mysql connector located here : http://dev.mysql.com/downloads/connector/net/6.0.html 

 2. Add a reference to the mysql.data.dll  (for some reason mysql.data is missing from the .net  reference tab). If that is the case for you downlaod the "Windows Binaries, no installer (ZIP)" version and click on the browse tab and locate the the mysql.data.dll manually.

3. Add the using MySql.Data.MySqlClient to your project.

4.  Create your connection MyConnection.ConnectionString = @"SERVER=" + dbHost.text + ";" + DATABASE=" + Database.text + ";" + "UID=" + dbUsernme.text + ";" + "PASSWORD=" + dbPassword.text + ";";

5. Then Test it.

Let's share thisShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn