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
3
Medium Priority
?
680 Views
Last Modified: 2013-11-26
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
Comment
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
  • Learn & ask questions
  • 2
3 Comments
 
LVL 25

Expert Comment

by:dstanley9
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

by:dranizz
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 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.
0
 
LVL 25

Accepted Solution

by:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question