利用VS的C#语言连接MySQL数据库

1.连接数据库本质上是使用MySql.Data.dll动态链接库,动态库中的方法:

MySqlConnection:连接MySQL服务器数据库。

MySqlCommand:执行一条sql语句。

MySqlDataReader:包含sql语句执行的结果,并提供一个方法从结果阅读一行。

MySqlTransaction:代表一个SQL失误在一个MySQL数据库。

MySqlException: MySQL报错时返回的Exception。

MySqlCommandBuilder: Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated MySQL database.

MySqlDataAdapter: Represents a set of data commands and a database connection that are used to fill a data set and update a MySQL database.

MySqlHelper: Helper class that makes it easier to work with the provider.

2.添加动态链接库文件

1.用HeidiSQL连接MySQL数据库不成功,可以将C:\Program Files\MySQL\MySQL Server 5.7\lib\libmysql.dll复制到HeidiSQL的安装目录下。

2. 方法一:Visual Studio,在 项目(右键)-管理NuGet程序包(N)  然后在浏览里面搜索MySql.Data并进行安装。(已测试,使用的是.NET Framework 4.6,VS2017.4.8版本&#x

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值