vs2013 linq to mysql
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 == 2); info.email = "xxxxxx@126.com";
db.SaveChanges(); }
using (WorkerContainer db = new WorkerContainer()){ workers_info infoModel = new workers_info(); infoModel.email = "22222222"; infoModel.salary = 3; infoModel.workername = "zhaoiyue"; infoModel.EmployedDates = DateTime.Now; infoModel.department = "12312"; db.workers_info.Add(infoModel); db.SaveChanges(); }