EF 连接数据库 Mysql (database first ) 一个表对应一个模型
准备工作
1.下载vs2015

2.下载mysql2017

3.安装

1.创建数据库


2. 将数据库映射成模型


3创建aspx 文件。
写下窗体内容的代码
hello_worldEntities entity = new hello_worldEntities();
var query = from emp in entity.student
select emp;
GridView1.DataSource = query.ToList();
GridView1.DataBind();
结果如下,在浏览器显示


浙公网安备 33010602011771号