Connect to MySQL in. Net

Source: Internet
Author: User

1. Download the MySQL driver. Contains DLLs that need to be connected to MySQL. Mysql-connector-net Address: http://dev.mysql.com/downloads/file/?id=463758. Because will keep updating, also can search inside Baidu: mysql-connector-net

2. Build the project with VS and then quote MySql.Data.dll. I use vs2012, so I can find it directly in the extension.

If you use a previous version, you may be able to find it. Then go to the Mysql-connector-net installation directory and copy the DLL to the project reference.

Before, it was said that, under the Webconfig configuration node, add the following statement

<System.Data><dbproviderfactories><Addname= "MySQL Data Provider"invariant= "MySql.Data.MySqlClient"Description= ". Net Framework Data Provider for MySQL"type= "MySql.Data.MySqlClient.MySqlClientFactory, Mysql.data, version=5.2.1.0, Culture=neutral, publickeytoken= C5687fc88969c44d " /></dbproviderfactories></System.Data>

However, after testing, I used 6.9.9, do not need to add this paragraph can also be used normally. If, in the use of time, there is a problem can try to add this paragraph under Webconfig, remember to change the version number of the edition = 5.2.1.0 to the version number of their own download

The code is then written. and the previous link SQL syntax basically no difference, just before the SqlConnection, SqlCommand, became. Mysqlconnection, Mysqlcommand

Put an example of yourself here.

Connect to MySQL in. Net

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.