To access the database from C#, you need a data string. Create a text file anywhere and rename it to something like mysql.udl. The name isn't important but the extension is crucial.
Right click open on the file from Windows Explorer and you'll get a dialog up that looks like this. Click the provider Tab, select your Connector again then click the connection tab and click the Use connection string and click build. Click the Machine Data Source and select your DSN then click the OK button. Now fill in your user name password and select the initial catalog (it means database) and so Test Connection.
Now for once I am putting in something that is technically invalid. Why? Because it may be valid in the future and you can use this for any database you want to access that supports OleDb e.g. MS Access, Oracle. If you know the OleDB way of doing things then you'll be familiar with this.
The problem is the OleDB configuration (right click open on any .udl file) does not show the ODBC 3.51 connector. Normally you would use this dialog then create the connection and press Ok. This writes the .udl (It's called Microsoft Data Link) file with the connector string. It looks something like:
Provider=MSDASQL.1;Persist Security Info=False;User ID=root;Data Source=sirius;InitialBut that won't work with the ODBC connector. I turned to the connectionstrings.com website and found that it should be like this:
Catalog=mydogshows3
Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=mydogshows3; User=root;Password=xxx;Option=3
That is the key secret to using MySQL with .NET!
On the next page - Using MySQL in C#


