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.
- using MySQL.Data.MySQLClient;
- ........
- MySQLConnection myConnection=new MySQLConnection("server=localhost;user id=root;password=XXXX;database=baby");
- string sql="select * from admin";
- MySQLDataAdapter myda=new MySQLDataAdapter(sql,myConnection);
- DataSet mydataset=new DataSet();
- myda.Fill(mydataset,"admin");
- mydatagrid.DataSource=mydataset;
- 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.