Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

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

Posted on 2007-03-30
Medium Priority
680 Views
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?
0
Question by:dranizz
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 25

Expert Comment

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

Author Comment

ID: 18845181
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 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.
0

LVL 25

Accepted Solution

dstanley9 earned 1000 total points
ID: 18845252
If Cadency is 0, it will go to the second option in the IIF, and will divide by 0.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
###### Suggested Courses
Course of the Month4 days, 14 hours left to enroll