[thelist] Line breaks with ASP

Lonnie.Kraemer lwkraemer at directvinternet.com
Sun Oct 27 10:17:00 CST 2002


> Actually, looking at the source, another one of my replace function
isn't
> working either, what is wrong with this code?
>
> Function EscapeDBData(varDataLine)
>      if not(varDataLine = "") then
>                  varDataLine = Replace(varDataLine,"'","''")
>      else if not(varDataLine = "") then
>                  varDataLine = Replace(varDataLine,"%","%")
>      else if not(varDataLine = "") then
>                  varDataLine = Replace(varDataLine,vbcrlf,"<br />")
>   end if
>      end if
>   end if
>          EscapeDBData = varDataLine
> End Function
>
> The first line works, replacing ' with '' but the other 2 don't seem
to
> work.

The first works because the condition is met... the else(s) not being
considered. Simplify, for example:

Function EscapeDBData(varDataLine)
EscapeDBData=""
if len(varDataLine)=0 then exit function
varDataLine=Replace(varDataLine,"'","''")
varDataLine=Replace(varDataLine,"%","&#37;")
varDataLine=Replace(varDataLine,vbcrlf,"<br />")
EscapeDBData=varDataLine
End Function

--
Lonnie Kraemer
-----------------------------------------




More information about the thelist mailing list