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