C# .NET - Datatable compute not working - Asked By sunil p on 11-Jul-12 07:31 PM


I want to Sum the datatable column value.I am using Copmute method to achive this.


But i am getting this error message"Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier"

Please anybody resolve this problem

Jitendra Faye replied to sunil p on 12-Jul-12 02:27 AM
Check the syntax for compuet() mthod

refer this link-


private void ComputeBySalesSalesID(DataSet dataSet)
    // Presumes a DataTable named "Orders" that has a column named "Total."
    DataTable table;
    table = dataSet.Tables["Orders"];

    // Declare an object variable.
    object sumObject;
    sumObject = table.Compute("Sum(Total)", "EmpID = 5");