Asp.net connection to MySQL database

Source: Internet
Author: User
Tags mysql odbc driver

The database Asp.net + MSSQL 2000 was used by the website. As a result, the new project says that the MSSQL database is too expensive and you need to change it to MySQL.

 

Connector/NET 6.3.5

Http://www.mysql.com/downloads/connector/net/

Latest Database Connector: http://mysql.stu.edu.tw/Downloads/Connector-Net/mysql-connector-net-6.3.5.zip
After the installation, introduce the corresponding dynamic link library mysql.net and using namespace in the project: mysql. Data. mysqlclient (thisCode)

Since then, in MSSQL code, you only need to replace all the SQL statements with MySQL. Before that, you can use the SQL Server database code to directly use the MySQL database.

Problem 1: "The requested. NET Framework data cannot be found to provideProgram. It may not be installed. "Error

 

Use the above method to replace the SQL statement in the entire project with MySQL. There is no problem on the local test page, but submit

How to operate this part on the server .?!!
In the development stage, you can install mysql-connector-net-6.3.5.zip to ensure development is complete.
However, if the connector is not installed on the server, problems may occur.

 

Solution: Reference: http://www.cnblogs.com/scottckt/archive/2009/12/30/1636475.html

 

Add the following code in Web. config to solve the problem: "The requested. NET Framework data provider cannot be found. It may not be installed ." . <! -- MySQL usage -->
< System. Data >
< Dbproviderfactories >
< Add name = " Mysql Data Provider " Invariant = " MySQL. Data. mysqlclient " Description = " . NET Framework data provider for MySQL " Type = " MySQL. Data. mysqlclient. mysqlclientfactory, MySQL. Data, version = 6.3.5.0, culture = neutral, publickeytoken = c5687fc88969c44d "   />
</ Dbproviderfactories >
</ System. Data >

Solve the problem!

If your version is not 6.3.5.0, you only need to modify version = in the above Code.

Additional reading:ASP. net2.0 using MySQL ODBC driver-myodbc 3.51 to connect to MySQL database

Http://www.longtengwang.com/Article/shujuku/MySQL/200712/7791.html

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.