terça-feira, 17 de setembro de 2013

Update using LINQ

 Hi!

This is a method from a project I'm currently working at.

        public void update(string id, string companyName)
        {
            DataClasses1DataContext lObjDC = new DataClasses1DataContext();
            var lObjCustomer = lObjDC.Customers.Where(x => x.CustomerID == id).Single();
            lObjCustomer.CompanyName = companyName;
            lObjCustomer.CustomerID = id;
            lObjDC.SubmitChanges();         
        }

Nenhum comentário:

Postar um comentário