tags:

views:

139

answers:

1

I have the following LINQ :

    Dim q = From p In ds_raport.Tables(1) _
      Group p By p!Cod_Prj Into g = Group _
      Select New With {g, .TotalVal = g.Sum(Function(p) p!Valoare)}

The problem is because column "valoare" is of type string ( i import this from a file that is not always properly formatted) my sum has no decimals.

So how can i make the sum to display decimals ?

+1  A: 

You need to parse the string into a decimal type, like this:

g.Sum(Function(p) Decimal.Parse(p!Valoare))
SLaks
thanks, it's working fine now.
Iulian