Language: Add EscapeForSQL string extension method
This commit is contained in:
parent
6ebd3b82b6
commit
8128987be4
@ -12,4 +12,15 @@ Public Module StringEx
|
|||||||
If String.IsNullOrEmpty(pString) Then Return pString
|
If String.IsNullOrEmpty(pString) Then Return pString
|
||||||
Return pString.Substring(0, Math.Min(pLength, pString.Length))
|
Return pString.Substring(0, Math.Min(pLength, pString.Length))
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Replaces single quotes in text for SQL Commands.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="pString">The string</param>
|
||||||
|
''' <returns>The escaped string.</returns>
|
||||||
|
<Extension()>
|
||||||
|
Public Function EscapeForSQL(pString As String) As String
|
||||||
|
If String.IsNullOrEmpty(pString) Then Return pString
|
||||||
|
Return pString.Replace("'", "''")
|
||||||
|
End Function
|
||||||
End Module
|
End Module
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user