Search code examples
vb.netasp.net-mvc-3entity-framework-4.3

Entity Framework Update Statement


I'm trying to update a specific record based off of a users selection. Regarding Entity Framework syntax, I'm not very familiar. Is it possible to achieve this SQL statement in Entity FrameWork?

Thank you!

  update Table1
  set Colum1='1'
  where Column2='1234567'

Solution

  • var record = _db.Table1.where(r => r.Column2 == '1234567');
    record.Column1 = '1'
    _db.SaveChanges();
    

    where _db is the Entity Framework DbContext class...

    HTH.