I had tried to group and sum the datatable using LINQ. However, I got the error “Assign: Arithmetic operation resulted in an overflow.”
LINQ:
(From d in YourOriginDatatableVar.AsEnumerable
Group d by k=d(“GroupID”).toString.Trim into grp=Group
let n = String.Join(“,”,grp.Select(Function (x) x(“Value1”).toString.Trim).Distinct())
let p = String.Join(“,”,grp.Select(Function (x) x(“Value2”).toString.Trim).Distinct())
Let s=grp.Sum(Function (x) CInt(x(3).toString.Trim))
let ra = new Object(){k,n,p,s,d(“Value4”).toString}
Select dtReport.Rows.Add(ra)).CopyToDataTable
I knew why I have the error message now. It is because I need sum the value seem as 10000000000. It is out of the range. May I know is any ideas do solve this issues?