0

I have a datatable (say myNameDT) which has data like this

enter image description here

Expected result:

When sector is Price, if it has fund value and component OTHER THAN "Active Return Contribution, It should update the Fundvalue in respective sector of Component Active Return Contribution. same applied for Index Value. Note: After update it should delete the unnecessary rows.

The result should look like,

enter image description here

Need as LINQ only. I have tried something as naive LINQ developer which is not fruitful. Thank you

Manivannan KG
  • 371
  • 1
  • 9
  • 24

1 Answers1

0

What you're looking for is not feasible in a single LINQ statement. This is imposed not by LINQ itself but by the concept of SQL that LINQ relies on to perform operations on data. One of the things LINQ does, it lets you chain operations on the same dataset by combining them in a single query, however SELECTs cannot be combined with UPDATEs or DELETEs.

Finally, if what you're looking for is only syntactic sugar - this is not possible. If you are looking for a way to organize a set of data operations in a single TRANSACTION, you may want to look at these questions that give a hint on how LINQ interprets transaction operations:

TransactionScope vs Transaction in LINQ to SQL

How to create a LINQ to SQL Transaction?

Community
  • 1
  • 1
Eduard Malakhov
  • 1,095
  • 4
  • 13
  • 25