How can I update a record against specific id in LINQ to SQL?
Linq – Update using LINQ to SQL
linqlinq-to-sql
Related Question
- C# – the syntax for an inner join in LINQ to SQL
- LINQ equivalent of foreach for IEnumerable
- Linq – Multiple “order by” in LINQ
- C# – Update all objects in a collection using LINQ
- C# – LINQ’s Distinct() on a particular property
- C# – Group By Multiple Columns
- C# – Using LINQ to remove elements from a List
- C# – Difference Between Select and SelectMany
Best Solution
LINQ is a query tool (Q = Query) - so there is no magic LINQ way to update just the single row, except through the (object-oriented) data-context (in the case of LINQ-to-SQL). To update data, you need to fetch it out, update the record, and submit the changes:
Or write an SP that does the same in TSQL, and expose the SP through the data-context: