Null Values

# Thread: Null Values

1. Junior Member
Join Date
Dec 1969
Posts
24

## Null Values

I have tried to get the following script to display a value of 0.00 when a null value is returned, but all I get is a blank box using<BR>&#060;% if isnull(NetValue) then<BR> NetValue = 0<BR> else<BR> NetValue = NetValue<BR> End if%&#062;<BR><BR><BR>This is the script I use to pull the original value.<BR>&#060;%rst.OPEN "SELECT * FROM vwMikesServiceReport WHERE Month = &#039;" + CurrMonth + "&#039; AND Year = &#039;2001&#039; AND EngineerTeamID = &#039;p&#039; AND BusinessLine = &#039;1010&#039;", conn, 0, 1<BR> do while Not rst.eof%&#062;<BR><BR>&#060;%=formatNumber(rst.Fie lds("NetValue"),2)%&#062;<BR><BR>&#060;%Dim sou1010<BR> sou1010 = rst.Fields("NetValue")%&#062;<BR><BR>&#060;%rst.Mo veNext<BR> Loop%&#062;<BR><BR>&#060;%rst.close%&#062;<BR><BR> <BR>How do I get this to display a value of 0.00 when null?

2. Senior Member
Join Date
Dec 1969
Posts
487

## RE: Null Values

Your function is quite correct, you just aren&#039;t calling it. Here, run this and work through how and where the function is called ....<BR><BR><BR>&#060;%<BR>&#039; Here&#039;s the function<BR>function nullToInt (str)<BR>if isnull(str) then <BR> nullToInt = 0 <BR>else <BR> nullToInt = str <BR>end if<BR>end function<BR><BR><BR>dim aNull<BR>aNull = Null<BR><BR>Response.Write formatNumber(nullToInt(aNull),2)<BR><BR><BR>HTH<BR ><BR>Darren<BR>string darren@showusyourcode.com ;

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•