Hi I have a datatable which has an amount column & a status column. I want to sum only those rows who have status '1'. How to do this ? I am summing the column via datatable Compute method. Please advice.
Hi, that was quick. Thanks thelost ! I am having a little problem. My status datacolumn is a boolean. I am having error "Object cannot be cast from dbNull to other types"CompTab.Columns.Add(new DataColumn("IsRep", typeof(bool)));CompTabRow["IsRep"] = true;.......total = Convert.ToDecimal(CompTab.Compute("SUM(Share)", "IsRep=false"));
Popo
2010-08-11 05:35:03
Edit: Sorry, my bad. I found there were no innitial rows inside datatable matching the criteria.
Popo
2010-08-11 05:42:35