c# - updating multiple records in database with linq to sql without loop, is it possible? -


ok, let want update multiple rows in database @ once, without looping, if loop, might :

var products = (from prod in context.products                prod.productcategoryid == myproductid                select prod).tolist();   // modify each object foreach (var product in products) {     product.phonenumber = ???;     product.name = ???;     product.address = ???; }   context.submitchanges(); 

is there better way this? without doing loop? consider me beginner on linq, if there better way, great if provide me example, in advance.

linq quering records. current foreach loop more readable , if try other approach use loop internally.

you can see this answer modifies collection using linq, not recommended way.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -