How do I add a reference to the MySQL connector for .NET?

What does this mean: Next add reference to: MySql.Data

actually I have downloaded mysql connector/net. by following these instructions:

First, you need to install the mysql connector/net, it is located at: http://dev.mysql.com/downloads/connector/net/1.0.html

Next create a new project

Next add reference to: MySql.Data

Next add "using MySql.Data.MySqlClient;" but im not able to install the connector.

website:http://bitdaddys.com/MySQL-ConnectorNet.html


Solution 1:

"Add a reference to MySql.Data.dll" means you need to add a library reference to the downloaded connector. The IDE will link the database connection library with your application when it compiles.

Step-by-Step Example

I downloaded the binary (no installer) zip package from the MySQL web site, extracted onto the desktop, and did the following:

  1. Create a new project in Visual Studio
  2. In the Solution Explorer, under the project name, locate References and right-click on it. Select "Add Reference".
  3. In the "Add Reference" dialog, switch to the "Browse" tab and browse to the folder containing the downloaded connector. Navigate to the "bin" folder, and select the "MySql.Data.dll" file. Click OK.
  4. At the top of your code, add using MySql.Data.MySqlClient;. If you've added the reference correctly, IntelliSense should offer to complete this for you.

Solution 2:

In Visual Studio you can use nuget to download the latest version. Just right click on the project and click 'Manage NuGet Packages' then search online for MySql.Data and install.

Solution 3:

When you download the connector/NET choose Select Platform = .NET & Mono (not windows!)