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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid use of Null: 'Round' error

Status
Not open for further replies.

pdotd

Programmer
Jun 15, 2004
29
CA
Is there a problem rounding a real number in ASP.

I retreive the real number from a MS SQL database, but when I run my script the numbers add up fine, however i get numbers with a 10 digit decimal place(i.e 125.199999988079) so when i try to use the round function, I get and error saying:


Invalid use of Null: 'Round'

any help?
 
Can you show us your code...

Round(yournumber,0) should do it...

-VJ
 
<% = round(DiUnitsUsed, 2) %>

this is the code i use.
 
ok...Your code is perfectly fine...

is there any chance that your DiUnitsUsed can be a NULL ??

if so the Round functions throws an error...

-VJ
 
where your round call is :

if isnull(DiUnitsUsed) then
DiUnitsUsed_Out = 0
else
DiUnitsUsed_Out = round(DiUnitsUsed, 2)
End If

-----------------
then in your page code :
<%=DiUnitsUsed_out%>

[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top