Page 1 of 1

How to Update/delete some rows?

Posted: Fri 23 Sep 2011 12:56
by Blave
I can update one row by:
db.table.First().Salary = 99999;

But, how can I update some rows without foreach, for, or while loop?

Thanks for your help.

Posted: Mon 26 Sep 2011 11:23
by Shalex
LINQ to Entities is used only the SELECT queries (no DML support). So it is necessary to read all records on the client's side (foreach, for, or while loop), modify, and write to database. Usually this task can be done faster using native SQL (not EF).
If you have to use Entity Framework, please try Batch Updates (http://www.devart.com/blogs/dotconnect/ ... html#Batch).