Demonstration of connecting to MySQL database in asp.net

Source: Internet
Author: User

Today, I am mainly talking about the correct operation process for connecting to the MySQL database in asp.net. We all know that the process of connecting to the MySQL database in asp.net is not complicated, is there any way we use ELE. Me? The following is the detailed description of the article.

Recently tried to use asp.net 1.1 to connect to MySQL, the original discovery of MySQL itself provides the provider (http://www.MySQL.com/products/connector/net/), to the above address to download, and then SETUP installation, very simple, also with SAMPLE.

Currently, FOR is provided based on the version. . NET 1.0, 1.1) References its DLL. The simple code is as follows, which is similar to that of common data. sqlclient.

 
 
  1. using MySQL.Data.MySQLClient;   
  2. ........   
  3. MySQLConnection myConnection=new MySQLConnection("server=localhost;user id=root;password=XXXX;database=baby");   
  4. string sql="select * from admin";   
  5. MySQLDataAdapter myda=new MySQLDataAdapter(sql,myConnection);   
  6. DataSet mydataset=new DataSet();   
  7. myda.Fill(mydataset,"admin");   
  8. mydatagrid.DataSource=mydataset;   
  9. mydatagrid.DataBind();   

Is it easy?


The above content is an introduction to connecting to MySQL in asp.net. I hope you will have some gains.

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.