This is code that returns list of data from Splatt Table.
Public Function GetListofProduct(ByVal pCOde As String, ByVal date1 As DateTime, ByVal date2 As DateTime) As List(Of Splatt)
Return (From e As Splatt In TradingCTX.Splatts Where e.plCode.Contains(pCOde) And (e.plDate = date1 Or e.plDate = date2)).ToList
Instead of writing the Linq the way you are try like this. This will give you the sum, but you can also return your list by calling
ToList() instead of
Sum. You can also use
Dim sum As Double = TradingCTX.Splatts.Where(Function(e) e.plCode.Contains(pCOde) And (e.plDate = date1 Or e.plDate = date2)).Sum(Function(e) e.Charges)
You could keep your Linq and just change your
.Sum(Function(e) e.Charges) where
e.Charges is the name of the field you want to sum.
Please explain your difficulties getting the sum value to another table.