Displaying  Source Code(s)  
 

 
Replace Single Quotes

--------------------------------------------------------------------------------

Description : This script will replace single quotes so the data is SQL-safe

<%
Function fncReplaceSingleQuotes( _
ByVal strToReplace _
)

On Error Resume Next
Const Proc = "fncReplaceSingleQuotes"

strToReplace = Replace(strToReplace, "'", "''")

fncReplaceQuote = strToReplace

If Err.number <> 0 Then
Call subWriteError(Err.number, Proc, Err.description)
End If

End Function
'
' ...
'
strVar = Request.Form("txtField1")
strVar = fncReplaceSingleQuotes(strVar)
%>
 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG