Thursday, February 18, 2010

Linq to SQL Update Method

//Creating Employee DataContext object
EmployeeDBDataContext db = new EmployeeDBDataContext();

//Selecting an employee to update his name and address
emp = db.Employees.Single(e => e.EmpID == 1);
emp.Name = "Sabu";
emp.Address = "Cochin";

//Submitting changes
db.SubmitChanges();

1 comment:

  1. Nice one!!!!!! i was searching long back

    ReplyDelete