1
I have a DataTable
containing a column called SubTotal
. I would like to add up the total value of this column.
I tested some examples:
object sumObject;
sumObject = table.Compute("Sum(Amount)", "");
This one too:
this.LabelControl.Text = datatable.AsEnumerable()
.Sum( x => x.Field<int>( "Amount" ) )
.ToString();
But they didn’t work. How to do this?
That’s it, you need to figure out what you’re doing wrong, but since you didn’t post a [mcve] it’s complicated for us to help.
– Maniero