且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用C#和.NET连接到MySQL数据库

更新时间:2022-11-29 21:23:17

可以在以下位置找到: ^ ]
Can be found at: http://www.connectionstrings.com/mysql[^]


您需要添加"MySql.Data"的引用,然后将代码编写为
You need to add Reference of "MySql.Data" and then need to write your code as
using MySql.Data.MySqlClient;
MySqlConnection con = new MySqlConnection("server=localhost;database=yourdatabase;uid=root;password=yourpassword");
con.Open(); // connection must be openned for command



您将在C#中罚款大量与mySQl的连接字符串相关的文章
^ ]



you will fine plenty of article related to connection string for mySQl in C#
Connecting to MySQL Database using C# [^]


尝试以下操作:
使用C#和.NET连接到MySQL数据库
如何连接到MySQL 5.0.通过C#.Net和MySql Connector/Net
与MySQL服务器的连接
如何使用C#访问MySQL
Try following:
Connecting to MySQL Database using C# and .NET
How to connect to MySQL 5.0. via C# .Net and the MySql Connector/Net
Connection to the MySQL Server
How to Access MySQL with C#