Because there is no data available to sum, this code is producing a null value and throwing an error. (The null value cannot be assigned to a member with type System.Decimal which is a non-nullable value type.)
Dim getLabor1 = Aggregate id In d.tblLaborInputs _
Where id.siteContract = CStr(Me.ComboBox1.SelectedItem) _
And id.NASAContract = ctrNo _
And id.WeekEnding >= CDate(CStr(mn & "-01-" & yr)) _
And id.WeekEnding <= CDate(CStr(mn & "-" & eom & "-" & yr)) _
Into Sum(id.WeeklyActuals)
I changed my code to this and a ton of other stuff but still, I get an error.
Dim getLabor1 = From id In d.tblLaborInputs _
Where id.siteContract = CStr(Me.ComboBox1.SelectedItem) _
And id.NASAContract = ctrNo _
And id.WeekEnding >= CDate(CStr(mn & "-01-" & yr)) _
And id.WeekEnding <= CDate(CStr(mn & "-" & eom & "-" & yr)) _
Aggregate xx In d.tblLaborInputs _
Into Sum(id.WeeklyActuals)
I get the error: System.Linq.IQueryable(Of <anonymous type>)' cannot be converted to 'Decimal'
I can't figure out what I am doing wrong. Help please!