Adding MySQL.Data as a Reference in Visual Studio Ultimate 2010
I'm creating a new C# project. I want to connect it with the MySQL server. When I click Add Reference, MySQL.Data is not shown. This leads to all sort of problems because I can't connect i开发者_如何学Got with my database.
I'm using Visual Studio Ultimate 2010 and MySQL 5.5.
Please help.
Thanks
MySQL isn't available "out of the box" in .NET.
You need to download the class library, and then add a reference to the class library once you've unpacked the zip file. In the "Add Reference" dialog box, go to the "Browse" tab (if I remember correctly) so that you can find the class library.
The MySql.Data dll is stored in:
Code:
C:\Program Files\MySQL\MySQL Connector Net \Assemblies
In the references window, choose the option to browse to the assembly directly.
If you install MySQL for Visual Studio with VS 2010 I found it here:
Add Reference > Browse > C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\MySql.Data.dll
You need to download the MySql Connector for dotnet. Once you have downloaded it, just install it. Then go to your project: i. Right click on the project and choose add -> Reference browse for the MySql.Data and select it to add. Reference is added now just include the following statement on top of your program file using MySql.Data.MySqlClient
You are then good to go
精彩评论