I am using Compute for summing up a datatable which has a condition. Sometimes, there are no rows inside the datatable matching my criteria so I get an exception on Compute Object cannot be cast from DBNull to other types.
Is there a way to check/filter the datatable to see if it has the desired rows, if yes only then I apply Compute. Please advice.
total = Convert.ToDecimal(CompTab.Compute("SUM(Share)", "IsRep=0"));