Please Help me!!!
How to sum all values in a column of data Table and how to change String to Boolean?
Please Check Photo!!!
DataTable
Trying this
Variable
Please Help me!!!
How to sum all values in a column of data Table and how to change String to Boolean?
Please Check Photo!!!
DataTable
Trying this
Variable
Hi @Hnin_Phyu
How about this expression?
(From d in dtData.AsEnumerable Where Not (isNothing(d("Column Name")) OrElse String.IsNullorEmpty(d("Column Name").toString.Trim)) Select v = CDbl(d("Column Name").toString.Trim)).Sum(Function (x) x)
Regards
Gokul
DataTable.Compute(… will return a result of DataType: Object
One of several object is to convert it into a Double as you had done
The Compute method is short and powerfull, but also very sensitive, when the values are not within the expectations (blanks, other formarts)
So a more control we can achieve e.g. with LINQ
Convert.ToBoolean, CX methods. But more important which String value should be converted?