How to access the MySQL database in. NET

Source: Internet
Author: User

If you have worked in a large group of companies, you will have the opportunity to access MySQL, although it does not support transaction processing, stored procedures, however, the functions provided by MySQL can satisfy most of your needs. In addition, simple MySQL has some unique advantages. In some cases, it is faster than large databases.

So how to access the MySQL database in. NET? Maybe many people will immediately say: OLEDB is used, but it is actually used. NET OleDb Data Provider cannot access MySQL. If you use it, the System will prompt you: "Net Data ole db Provider (System. data. odbc) does not support MSDASQL providers (Microsoft ole db providers for Odbc drivers ). ", I don't know why. According to the author of MySQLDriverCS, it is" abandoned by the owner ". Well, there are still some stories.

Fortunately, we have other options. Here we will introduce two methods to access the MySQL database.

Use ODBC. NET

ODBC. NET (full name ODBC. NET Data Provider) is a free.. NET Framework, which needs to be downloaded from the Microsoft website. The system must have MDAC 2.7 or a later version installed. In addition, you also need to install the ODBC driver for MySQL and configure the DSN in "ODBC data source Manager", as shown in:

In the design of objects, ODBC. NET is also the same as OLEDB and SQL, namely OdbcConnection, OdbcCommand, OdbcDataAdapter, and OdbcDataReader. The usage is also the same. If you want to use ODBC.. NET to replace the previous OleDb. NET Data Provider, in fact, you can find a replacement method to modify your program.

  • 2 pages in total:
  • Previous Page
  • 1
  • 2
  • Next Page

Related Article

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.