This article mainly introduces the actual operation steps for CSharp to connect to the MySQL database. We all know that with the wide application of the MySQL database, its related applications are also paid attention, the following articles mainly introduce the actual operation steps and specific applications of CSharp to connect to the MySQL database.
Category: C #, MySQL
1. Right-click Project and add reference to add MySQL. data to your project.
2.
- Using MySQL. Data. MySQLClient;
3. Configure webconfig as follows:
- <Add key = "MySQLConnectionString" value = "Server = 192.168.0.77; user id = root; password = 'dd'; charset = gb2312; database = xxxx"/>
4. Connect.
Note: charset = gb2313 must be the same as that set in the MySQL database.
The above content is an introduction to CSharp's connection to the MySQL database. I hope you will have some gains.