Procedure for connecting CSharp to the MySQL database

Source: Internet
Author: User

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.

 
 
  1. Using MySQL. Data. MySQLClient;

3. Configure webconfig as follows:

 
 
  1. <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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.