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