Using the below mentioned query I am getting the all the values of a column called
promotionValue . I want to get the sum of all the values of *matched *
var matched = from table1 in dvtempPropertyRoomRatePromotion.ToTable().AsEnumerable()
join table2 in dvPropertyRooms.ToTable().AsEnumerable() on
table1.Field<DateTime>("RateDate") equals table2.Field<DateTime>("RateDate")
where table1.Field<DateTime>("RateDate") == table2.Field<DateTime>("RateDate")
select table1.Field<string>("promotionValue");
You need to parse the string to
intordecimal:Note that i’ve also changed some other things like the redundant
where(since you’ve already joined these tables) or theDateproperty ofDateTime.Apart from that
DataViewat all?ToTablecreates always a newDataTable. Why don’t you useLinq-To-DataSetfor all? I assume you’ve used theDataViewfor filtering, useEnumerable.Whereinstead. That would be more consistent, more efficient and more readable.promotionValuea string? You should store it as a numeric type.