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