MySQL and. NET application parsing _ MySQL

Source: Internet
Author: User
MySQL and. NET application parsing MySQL has gradually become a practical database solution when selecting a database platform. What proves this is that many companies choose mySQL as their database platform, such as Google, The Associated Press, and NASA ). Although for an open source code, the low price is often used as the main advantage to persuade customers, but for a large-scale organization like Google, they do not trust in storing very useful information in a database product with only price advantages. The real strength of MySQL far exceeds his price advantage. It provides a wide range of additional tools from the open source code community and commercialization.

Data integration with. NET

The MySQL community has developed MySQL data interfaces, which provide basic functions for connecting data sources and program code. On Windows, the following MySQL Connector is available:

MySQL Connector/Net 1.0 (formerly called ByteFX. Data): It is an open source code. NET Data interface designed for MySQL. It is fully developed using C #. we can find it on MySQL.com. (Note: In this example, we will use the MySQL Connector/Net 1.0 data interface to connect to the database. you can install it easily by using the Windows installer, its code examples and documents are also included .)

MySQLDirect. NET Data Provider: a commercial Data interface developed by Core Lab. The price is determined by the type of the purchased license, but we can download its trial version.

If you use Mono, you can find the PHP connector download on the Mono website. If you run Mono on Windows, the connector you downloaded contains the installer. If not, download the appropriate connector based on your operating system type.

Use the MySQL data interface

After installing the MySQL data interface, you must introduce it in your code to use it. You can use the namespace MySql. Data. MySqlClient to connect to the MySQL server. In C #, you can use the using statement to introduce the MySQL data interface:

Using MySql. Data. MySqlClient;

In addition, you can use the Import command in an ASP. NET Web Form to introduce the MySQL data interface:

Alternatively, you can use this namespace in your code to write the complete path of all classes, however, this will waste more bytes than using the Import command to Import more characters. After the namespace is specified, we can interact with the MySQL database. MySql. Data. MySqlClient this namespace provides many classes for processing MySQL Data. Below is a sample of these classes:

MySqlConnection: manages connections to MySQL servers/databases;

MySqlDataAdapter: a set of commands and connections used to fill DataSet objects and update MySQL databases;

MySqlDataReader: Allows you to read data from a MySQL database. It is a one-way data stream;

MySqlCommand: provides the function of sending commands to the database server;

MySqlException: provides exception handling when a problem occurs.

We will use some of these classes to interact with our sample database.

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.