Friday, August 14, 2009

Multiple Update using LINQ query in one statement


AccreditationDataContext objDb=new
AccreditationDataContext ();

var employees = data.Employees.Select(EM=>EM)).ToList();

employees.ForEach(EM => EM.City = "ABC");


Another way is :

AccreditationDataContext objDb=new AccreditationDataContext ();

var employees = data.Employees.Select(EM=>EM)).ToList();

employee.Where(EM=> { EM.City="ABC" ; return true; });