I have two related tables in MS SQL.
Example...
Table A – Room
RoomId
RoomCost
Table B – RoomItem
RoomItemId
ItemName
ItemCost
RoomId
I need help in writing a LINQ code that will add RoomCost then Sum ItemCost (if they have the same RoomId) and post the results in a WPF textbox. So far I have tried
DataclassesDataContext dc= new DataclassesDataContext();
var RoomAmount = (from dbo in dc.Room select dbo.RoomCost).Single();
var ItemAmount = (from itm in dc.RoomItem select itm.ItemCost).Single();
decimal RmAmount = Convert.ToDecimal(RoomAmount);
decimal ItmAmount = Convert.ToDecimal(ItemAmount);
decimal TAmount=RmAmount+ItmAmout;
txtTotalAmount.Text=TAmount
I am a beginner in C#, Kindly help. If I haven't been clear enough, just ask. Thanks