How to update record using LINQ programmtically?


to update record using LINQ programmtically

eInsuranceDataContext = new eInsuranceDataContext(); // LINQ object


// News is the database table inside the LINQ object, NewsMastKey is the primary key that is used to compare the value


objNewsMast = NewsMasts.SingleOrDefault(Rec => Rec.NewsMastKey == 2);
if (objNewsMast != null)
{

objNewsMast.Dsc = "Today News";
objNewsMast.Title = "Latest News";
objNewsMast.Ext = "Mpg";
objeDC.SubmitChanges();

}


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: