Update 2 table values in one query in LINQ

Posted by fireBand on Stack Overflow See other posts from Stack Overflow or by fireBand
Published on 2010-04-26T13:35:09Z Indexed on 2010/04/26 13:43 UTC
Read the original article Hit count: 161

Filed under:
|

Hello,

I have 2 tables Table1 with columns [BId,Name,Amount] Table2 with columns [CId,BId, ExpenseType,Expense]. BId Is the foreign key in Table2.

The Amount field in Table1 is always higher than Expense in Table2. I need to update the values of Amount (increase or decrease) based on value of Expense and I want to do it in single query in LINQ. Eg If the Expense has to be updated with 200, I would decrease(negate) Amount value with 200. If Expense is reduce to 100 then the Amount is increased by a value of 100.

Thanks in advance for any suggestions.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about LINQ