I am getting the below error while computing the SUM with DataTable.
Invalid usage of aggregate function Sum() and Type: String.
I am using the below code:
lblQuestionnaireTotalTime.Text = CalculateMinutes(
Convert.ToInt32(
(
(DataSet)Session["DsQuestionaire"]).Tables["Questions"]
.Compute("Sum(EstimatedCompletionTime)", "")));
It always throws an error. I have tried the how-to-calculate-the-sum-of-the-datatable-column-in-asp-net and
how-can-i-get-a-sum-for-the-column-pieces-in-a-datatable and some other links but not able to resolve the issue.
Here is how i m adding column to datatable
dtQuestions.Columns.Add(new DataColumn("EstimatedCompletionTime", typeof(Int32)));