Linq noob here. How do I correct this?
var result = (from row in rulestable.AsEnumerable()
let sup = row.Field
When I run this query I failed in visual studio. On More search found the following and worked well in my system.
var result = (from row in rulestable.AsEnumerable()
group row by new {sup= row.Field("Supplier"),
vat=row.Field("VatRate")} into grp = Group
select new With
{.Supplier = sup,
.Amount = grp.Sum(r => r.Field("Amount")),
.Advance = grp.Sum(r => r.Field("Advance")),
.Balance = grp.Sum(r => r.Field("Balance")),
.VatRate = vat
}
).ToList();