In a C# 2010 application I would like to be able to use linq instead of sql to update from to 1 to 6 specific columns in a table
that is stored in sql server 2008 r2 database. I am asking that question since I know linq is the preferred method over using sql.
I do know what the key to the table is.
Thus can use tell me how to acdcomplish this goal?
Loading
Jignesh TrivediPosted Jun 25, 2012, 1:48 AM
Please refer,
http://blogs.msdn.com/b/wriju/archive/2008/08/21/ado-net-entity-insert-update-and-delete.aspx
http://www.codeproject.com/Articles/246861/LINQ-to-Entities-Basic-Concepts-and-Features
hope this will help you.
Posted Jun 25, 2012, 12:35 AM
2) Modify the values.
3) Commit the changes to db.
DataContext db = new DataContext()
User user = db.Users.Single(u=>u.Id == 10);
user.FirstName = "New First Name";
user.LastName ="New Last Name";
//modify the other properties.....
db.SubmitChanges();
Hope this helps you.