Advanced LINQ Update Statement
Posted
by
user1902490
on Stack Overflow
See other posts from Stack Overflow
or by user1902490
Published on 2012-12-13T22:42:18Z
Indexed on
2012/12/13
23:03 UTC
Read the original article
Hit count: 267
I have a data base with Price_old
like:
Date --- Hour --- Price
_____________________________
Jan 1 --- 1 --- $3.0
Jan 1 --- 2 --- $3.1
Jan 1 --- 3 --- $3.3
Jan 1 --- 4 --- $3.15
Jan 2 --- 1 --- $2.95
Jan 2 --- 2 --- $3.2
Jan 2 --- 3 --- $3.05
What I then have is a spreadsheet, with the same structure, that I will be reading into a datatable, I'll call the new datatable Price_New
, note that price new may not have all the same date/hours as Price_Old
So, I end up with 2 datatables, Price_Old
, and Price_New
, and what I need to do is update Price_old
with the new prices in Price_New
, and then commit those new prices to the Database.
I am kinda new to LINQ (about 30 mins of experience) and would really appreciate if someone could give me a pointer or two on whether or not this is doing in LINQ and what the best method would be.
Thanks
© Stack Overflow or respective owner