vs2013 linq to mysql

时间:2023-02-08 09:20:15

安装文件

1.下载安装文件

2.创建项目

3.创建mysql数据连接

4.新建ADO.NET数据模型

项目实现代码

 using (WorkerContainer db = new WorkerContainer()){
IQueryable<workers_info> linq = from c in db.workers_info select c;
List<workers_info> list = linq.ToList();
}
            using (WorkerContainer db = new WorkerContainer()){
var info = db.workers_info.SingleOrDefault<workers_info>(s => s.id == );
info.email = "xxxxxx@126.com";
           db.SaveChanges();
}
  using (WorkerContainer db = new WorkerContainer()){
workers_info infoModel = new workers_info();
infoModel.email = ""; infoModel.salary = ;
infoModel.workername = "zhaoiyue";
infoModel.EmployedDates = DateTime.Now;
infoModel.department = ""; db.workers_info.Add(infoModel);
db.SaveChanges();
}