Problem assigning a sum value to a list from a datatable

Hi All,

I’m currently using this expression to sum a datatable column by a grouping (Total by Currency) before assigning the list to another datatable using a for each row loop:

ListA = (From p In dta.Select()
Group p By ID=p.Item(“Currency”).ToString Into GroupA=Group
Select.Covert.ToString(GroupA.Sum(Function(x) Convert.ToDouble(x.Item(“Total”).ToString)))).ToList()

Now, this works OK, except when it sums to a zero, where I get that odd numerical representation of zero we sometimes see in Excel (eg 1.16415321826935E-10) - this causes me problems later on in the my process.

So, I’m trying to execute a version of the above code but using Convert.ToDecimal instead of Convert.ToDouble, but it is throwing me an error:

Expression of type ‘1-dimensional array of System.Data.DataRow’ is not queryable.

Any ideas?

Thanks in advance

Paul

OK, oddly I just got it to work by changing the Convert.ToDouble to Convert.ToDecimal, but had to delete the whole text from the assign block first, then select something else, then reselect the assign block and paste the text in from Notepad. A bug? Oddly enough, if I click back into the code part, the error comes back, but the automation runs and does what it ought to.

Very strange.