I am trying to write some linq code to sum numbers from column in a table with a between statement. Query looks good but I am getting an error "Cannot assign a method group to an implicitly typed local variable". The code is as follows:
public int GetDelithMinBetween(int unitID, DateTime currSampleTime, DateTime prevSampleTime)
{
DataDelithiationDataContext ddc = new DataDelithiationDataContext();
var prevDelithMinutes = (from pd in ddc.tblDelithiations
where (unitID.ToString() == pd.unitID.ToString()) && (pd.startTime <= currSampleTime && pd.endTime >= prevSampleTime)
select pd.delithMinutes).Sum;
return prevDelithMinutes;
}
Any help would be appreciated. Thanks.
public int GetDelithMinBetween(int unitID, DateTime currSampleTime, DateTime prevSampleTime)
{
DataDelithiationDataContext ddc = new DataDelithiationDataContext();
var prevDelithMinutes = (from pd in ddc.tblDelithiations
where (unitID.ToString() == pd.unitID.ToString()) && (pd.startTime <= currSampleTime && pd.endTime >= prevSampleTime)
select pd.delithMinutes).Sum;
return prevDelithMinutes;
}
Any help would be appreciated. Thanks.