Link to home
Start Free TrialLog in
Avatar of dranizz
dranizz

asked on

{"Cannot convert value 'Infinity' to Type: System.Int32."} when passing a 0 to type Int32

I have a DataColumn of Type Int32, when I try to pass it a value of 0 in code I get this exception:
{"Cannot convert value 'Infinity' to Type: System.Int32."}

Can someone explain and tell me how to do this without raising this exception?
Avatar of dstanley9
dstanley9

Do you have any calculated columns in the dataset?  Sounds like one of them is trying to divide by 0.
Avatar of dranizz

ASKER

Yes, that must be it, but my calculated columns has a formula that is testing if the value I use to divide is not 0.
Column 1 = Cadency
Column 2= QtyTotal
Column 3= NbrOfDays (Calculated Column)

NbreDays.Expression = " iif( QtyTotal > 1 AND  QtyTotal < Cadency AND Cadency > 0 ,1, QtyTotal / Cadency)"

I still get an error, even if I won't make the division if it's 0.
ASKER CERTIFIED SOLUTION
Avatar of dstanley9
dstanley9

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial