Click here to Skip to main content
15,072,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to update multiple rows at a time using linq to sql....i already know to update a single row....but multiple row is not getting..plz help me to find it....
Posted
Updated 25-Aug-21 10:09am
Comments
ZurdoDev 20-Jul-13 23:11pm
   
Post your relevant code and where you are stuck.

Try ExecuteCommand
C#
 DataContext db = new DataContext();
db.ExecuteCommand("update table set col1= col1 + 5 where col1 > 6");
   
Using this you can directly find and replace the complete row

DT.AsEnumerable().Where(X => X.Field<string>("Inventory") == FindID && X.Field<string>("Segment") == FindSegment).ToList().ForEach(Y => Y.ItemArray=DR.ItemArray) ;

DT.AcceptChanges();
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900