Home > Database > Mysql Tutorial > body text

asp.net中连接MySQL数据库演示

WBOY
Release: 2016-06-07 14:51:37
Original
1052 people have browsed it

今天主要和大家讲述的是asp.net中连接MySQL数据库的正确操作流程,我们大家都知道在asp.net中连接MySQL数据库的时机操作流程,并不复杂,只是我们所用饿方法有无,以下就是文章的具体内容描述。 最近尝试使用asp.net 1.1连接MySQL,原来发现MySQL本身就提供

  今天主要和大家讲述的是asp.net中连接MySQL数据库的正确操作流程,我们大家都知道在asp.net中连接MySQL数据库的时机操作流程,并不复杂,只是我们所用饿方法有无,以下就是文章的具体内容描述。

  最近尝试使用asp.net 1.1连接MySQL,原来发现MySQL本身就提供了provider(),到上面的地址下载了,之后SETUP安装,十分简单,本身也带SAMPLE的。

  使用的时候,先根据版本(目前提供FOR 。NET 1.0,1.1版本的)引用其DLL,之后简单代码如下,和普通的用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();   

  是不是很简单呢?

  asp.net中连接MySQL

  以上的相关内容就是对asp.net中连接MySQL 的介绍,望你能有所收获。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!