0
     UPDATE M_User
     SET id=string1,code=string2,name=string3
     WHERE code=certain_str;

can anyone give me the simple LINQ version of this. I tried looking for other post all I see are the ones I cant understand.

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
Johji
  • 240
  • 1
  • 19
  • 2
    LINQ to what? Entity Framework, NHibernate, Linq-to-SQL? LINQ is a query *only* language, not a replacement for SQL or a complete ORM. Each ORM has its own way of sending changes to the database – Panagiotis Kanavos Jul 04 '14 at 11:49
  • possible duplicate of [How do I save my object back into my database in LINQ to SQL?](http://stackoverflow.com/questions/428715/how-do-i-save-my-object-back-into-my-database-in-linq-to-sql) – Panagiotis Kanavos Jul 04 '14 at 11:50

1 Answers1

0

this might help you.

var result =
(from c in db.M_User
where c.Code == certain_Str
select c).First();

// Change the id, code, name
result.id = string1;
result.code = string2;
result.name = string3;

// Ask the DataContext to save all the changes.
db.SubmitChanges();
Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
Rahul Sharma
  • 347
  • 1
  • 16