日期:2014-05-18 浏览次数:20472 次
public bool Edit(Student sd) { Student ss = new Student(); ss.t_id = sd.t_id; ss.t_sname = sd.t_sname; ss.t_state = sd.t_state; ll.ApplyCurrentValues<Student>("Student",ss) ll.SaveChanges(); return true; }
using (var edm = new NorthwindEntities()) { Customers addc = edm.Customers.FirstOrDefault(cc => cc.CustomerID == "c2"); addc.City = "CD"; addc.ContactName = "cnblogs"; addc.Country = "CN"; int result = edm.SaveChanges(); Assert.AreEqual(result, 1); Customers updatec = edm.Customers.FirstOrDefault(cc => cc.CustomerID == "c2"); Console.WriteLine("CustomerId={0},City={1}", updatec.CustomerID, updatec.City); }