Pierre
Member
As I want to aggregate data from a dataset column, using VB.NET, I used the DataTable.Compute method.
The code that I developed is the following:
Load the list of expenses
Dim ItemsDataSet As New DataSet()
ItemsDataSet.ReadXml("ExpenseList.xml", XmlReadMode.InferSchema)
Dim CostTable As New DataTable()
CostTable = ItemsDataSet.Tables("CExpense")
Dim CostAmount As Object
CostAmount = CostTable.Compute("Sum(expenseAmount)", "expenseHouse = thisHouse")
When running it, I get the following exception: "Invalid usage of aggregate function Sum() and Type:String."
I do not understand what I need to do to fix this problem considering that the structure of this code mimics the one recommended by the .NET Framework Class Library.
FYI - The expenseAmount column that resides in the CExpense table (i.e. actually, the XML file that persists it) indeed contains only numerical data.
Any helt will be greatly appreciated!
The code that I developed is the following:
Load the list of expenses
Dim ItemsDataSet As New DataSet()
ItemsDataSet.ReadXml("ExpenseList.xml", XmlReadMode.InferSchema)
Dim CostTable As New DataTable()
CostTable = ItemsDataSet.Tables("CExpense")
Dim CostAmount As Object
CostAmount = CostTable.Compute("Sum(expenseAmount)", "expenseHouse = thisHouse")
When running it, I get the following exception: "Invalid usage of aggregate function Sum() and Type:String."
I do not understand what I need to do to fix this problem considering that the structure of this code mimics the one recommended by the .NET Framework Class Library.
FYI - The expenseAmount column that resides in the CExpense table (i.e. actually, the XML file that persists it) indeed contains only numerical data.
Any helt will be greatly appreciated!