Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Division by zero

Status
Not open for further replies.

achai

MIS
May 23, 2000
71
US
erro shows:<br>ODBC Error Code = 22012 (Division by zero)<br>[Microsoft][ODBC Microsoft Access 97 Driver]Division by zero (null)<br><br>who can tell me what's wrong with database?<br>
 
hmmm... I couldn't really say without looking at the code that is trying to access the db, but it looks like you are trying to divide something by zero (computers freak out when you try to do that)...<br><br>Maybe you have a CFQUERY that is something like:<br><br>select sum = column1/column2 from producttable<br><br>???
 
just figured it out.<br>yes. column2 has 0.<br>i delete column1/column2 from query<br>and add &lt;cfoutput query...&gt;&lt;cfif column2 is &quot;0&quot;&gt;bla bla bla&lt;/cfif&gt;&lt;CFIF column2 is NOT &quot;0&quot;&gt;bla bla bla&lt;/cfif&gt;<br><br>now everything is fine<br>thanks
 
A cleaner method may be:<br><FONT FACE=monospace><b><br>&lt;cfif column2&gt;&lt;!--- will return true if any number other than zero ---&gt;<br>&nbsp;&nbsp;&lt;cfset x=column1/column2&gt;<br>&nbsp;&nbsp;&lt;cfoutput&gt;#x#&lt;/cfoutput&gt;<br>&lt;cfelse&gt;<br>&nbsp;&nbsp;Division by zero not allowed<br>&lt;/cfif&gt;<br></b></font><br>This way, CF doesn't have to parse (and execute) two CFIFs (just a suggestion)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top