Sunday 16 February 2014

How to calculate the sum of the datatable column in asp.net?

To calculate the sum of a column in a DataTable use the DataTable.Compute method.

Example of usage

object sumObject = dtPayment.Compute("Sum(Amount)", "");

Display the result in your Total Amount Label like so:


lblTotalAmount.Text = sumObject.ToString();
 

No comments:

Post a Comment