Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15067

Arithmetic Overflow in LINQ

$
0
0
Hello all,

I have a sum in the follow query that produces a very large number, I can't seem to find a way to convert it preferably to a double. It needs to go into the trillions and have decimals places, although I can drop these for an int64.

I've tried (Of Double) and (Of Int64) in a variety of places, but I can't get it to work.

Code:

position = row.Cells("Position").Value
...
.position = Group.Sum(Function(x) x.position)


Code:

        Dim query = From row As DataGridViewRow In BulkGrid.Rows
                    Select vlref = row.Cells("vlref_main").Value, inst_code = row.Cells("Inst Code").Value, inst_name = row.Cells("Mapped Inst").Value,
                        fund_code = row.Cells("Fund Code").Value, fund_name = row.Cells("Mapped Fund").Value, holding_date = row.Cells("holding_date").Value,
                        position = row.Cells("Position").Value, research = row.Cells("Research").Value, grey = row.Cells("Grey").Value, notes = row.Cells("Notes").Value
                    Group By vlref, inst_code, inst_name, fund_code, fund_name, holding_date, research, grey, notes Into Group
                    Select New With {vlref, inst_code, inst_name, fund_code, fund_name, holding_date, research, grey, notes, .position = Group.Sum(Function(x) x.position)}

Thanks in advance for the assist.

Viewing all articles
Browse latest Browse all 15067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>