Correctly connect to the MySQL database in asp.net

Source: Internet
Author: User

This article mainly introduces how to correctly connect to the MySQL database in asp.net. I used asp.net 1.1 to connect to the MySQL database. It turns out that the MySQL database itself provides the provider, download the package from the above address, and then install SETUP, which is very simple and contains 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 the MySQL database in asp.net. I hope you will get something.

The above content describes how to connect to the MySQL database in asp.net. I hope it will help you in this regard.

Original article title: connecting to MySQL in asp.net

Connection: http://www.cnblogs.com/jackyrong/archive/2005/04/15/138603.html

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.