如何添加对 .NET 的 MySQL 连接器的引用? [英] How do I add a reference to the MySQL connector for .NET?
问题描述
这是什么意思:接下来添加对:MySql.Data
What does this mean: Next add reference to: MySql.Data
实际上我已经下载了 mysql 连接器/网络.按照以下说明操作:
actually I have downloaded mysql connector/net. by following these instructions:
首先,您需要安装mysql连接器/net,它位于:http://dev.mysql.com/downloads/connector/net/1.0.html
First, you need to install the mysql connector/net, it is located at: http://dev.mysql.com/downloads/connector/net/1.0.html
接下来创建一个新项目
接下来添加对:MySql.Data的引用
Next add reference to: MySql.Data
接下来添加使用MySql.Data.MySqlClient;"但我无法安装连接器.
Next add "using MySql.Data.MySqlClient;" but im not able to install the connector.
网站:http://bitdaddys.com/MySQL-ConnectorNet.html
推荐答案
添加对 MySql.Data.dll 的引用"意味着您需要添加对下载的连接器的库引用.IDE 会在编译时将数据库连接库与您的应用程序链接起来.
"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.
我从 MySQL 网站下载了二进制(无安装程序)zip 包,解压到桌面,然后执行以下操作:
I downloaded the binary (no installer) zip package from the MySQL web site, extracted onto the desktop, and did the following:
- 在 Visual Studio 中创建一个新项目
- 在解决方案资源管理器中,在项目名称下,找到引用并右键单击它.选择添加引用".
- 在添加引用"对话框中,切换到浏览"选项卡并浏览到包含下载的连接器的文件夹.导航到bin"文件夹,然后选择MySql.Data.dll"文件.单击确定".
- 在代码的顶部,添加
using MySql.Data.MySqlClient;
.如果您已正确添加引用,IntelliSense 应该会为您完成此操作.
- Create a new project in Visual Studio
- In the Solution Explorer, under the project name, locate References and right-click on it. Select "Add Reference".
- 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.
- 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.
这篇关于如何添加对 .NET 的 MySQL 连接器的引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!