G
Guest
Hello everyone
Here is what I am trying to do
I have a datatable with 7 columns (called Mon, Tue, Wed,...) representing the days of the week
I want to create a calculated column called totals that totals the 7 days of the week columns
I try to use the following code
Dim cTotal As DataColumn
cTotal = New DataColumn
With cTotal
.DataType = System.Type.GetType("System.Decimal")
.ColumnName = "First Totals"
.Expression = "Sun + Mon + Tue + Wed + Thu + Fri + Sat"
End With
dt.Columns.Add(cTotal)
But it does not work.
If I put in the following as the expression the column calculates fine
..Expression = "Sun + Mon"
Is it possible for me to add the values of 7 columns into 1 totals column?
Thanks
Corey
Here is what I am trying to do
I have a datatable with 7 columns (called Mon, Tue, Wed,...) representing the days of the week
I want to create a calculated column called totals that totals the 7 days of the week columns
I try to use the following code
Dim cTotal As DataColumn
cTotal = New DataColumn
With cTotal
.DataType = System.Type.GetType("System.Decimal")
.ColumnName = "First Totals"
.Expression = "Sun + Mon + Tue + Wed + Thu + Fri + Sat"
End With
dt.Columns.Add(cTotal)
But it does not work.
If I put in the following as the expression the column calculates fine
..Expression = "Sun + Mon"
Is it possible for me to add the values of 7 columns into 1 totals column?
Thanks
Corey