[thelist] Avoiding Divide by Zero within SQL...

Anthony Baratta Anthony at Baratta.com
Fri Nov 30 13:24:05 CST 2001


At 11:14 AM 11/30/2001, you wrote:
>Sounds like you need the case...when statement.

WhooHoo!!

(Quicky adding this to my memory banks - never used it before.)

Thanks.

<tip type="More fun with NULL in ASP" author="Anthony Baratta">

Be careful with some of the stock ASP data munging routines. If you pass 
them a NULL, they blow up. Wrap these functions in a custom function to 
test for Null (or Blank) first.

e.g.

''''''''''''''''''''''''''''''''''''''''''''''''''
'' URLData Function
'' Required Info Passed to Function:
''      varDataLine
''''''''''''''''''''''''''''''''''''''''''''''''''
Function URLData(varDataLine)
     if not(varDataLine = "" OR isNull(varDataLine)) then
                 varDataLine = Server.URLEncode(varDataLine)
     end if
         URLData = varDataLine
End Function

''''''''''''''''''''''''''''''''''''''''''''''''''
'' HTMLData Function
'' Required Info Passed to Function:
''      varDataLine
''''''''''''''''''''''''''''''''''''''''''''''''''
Function HTMLData(varDataLine)
     if not(varDataLine = "" OR isNull(varDataLine)) then
                 varDataLine = Server.HTMLEncode(varDataLine)
     end if
         HTMLData = varDataLine
End Function

</tip>
----
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."





More information about the thelist mailing list