简体   繁体   中英

Connecting mysql and c#

I have been following the instructions in the link in Visual Studio 2013.
In VS 2013, there is no "Add service reference" in solution explorer -> reference.
I'm unable to add reference of mysql through "Add reference". What should I do to complete that process in Visual Studio 2013?? or else do I have to use 2010 version??

"Add service reference" does not depend on Visual Studio 2013 or VS 2010 and even 2015.

It depends on which target framework you are using. You should use .NET Framework 3.0 and above to see this menu item.

But according to your link you do not need to add service reference. You should download the MySQL .NET connector and add the reference to the file:
in solution explorer select References -> Add reference -> Browse and open the folder C:\\Program Files\\MySQL\\MySQL Connector Net 6.9.7\\Assemblies\\v4.5 (if you use the installation path by default) or something like that and select MySql.Data.dll.
After that you can add using MySql.Data.MySqlClient; and use connector in your code.

Flawed are the instructions you're looking at.

You need the MySQL installer from http://dev.mysql.com/downloads/windows/installer/

You can customize the installer to only install the "MySQL for Visual Studio" addin version 1.2.4 and the Connector/NETversion 6.9.7. (Or you can install more stuff. But you've already installed WAMP.)

Install those things. Then you can use the Server Explorer to connect to your new MySQL database. You don't need any service references.

You can add the appropriate References for MySQL. Browse for them. You'll find them at a path like this

 C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies

Choose the right version of dotnet (4.0, 4.5?) and then choose the DLLs you need. MySql.Data is the basic one for doing sample programs like the one in the tutorial you pointed out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM