I have a DataTable
that contains a column named SubTotal
. I would like to add the total value of this column.
I tested some examples:
object sumObject;
sumObject = table.Compute("Sum(Amount)", "");
This too:
this.LabelControl.Text = datatable.AsEnumerable()
.Sum( x => x.Field<int>( "Amount" ) )
.ToString();
But they did not work. How to do this?