Re: Storing appostrophe's in SQL

From: Michel Pierron (michel.pierron_at_free.fr)
Date: 08/05/04


Date: Fri, 6 Aug 2004 00:13:10 +0200

Hi Jeff,
for example:
Function FixApostrophy(ByVal sSQL As String) As String
Dim sPhrase As String, wLength As Integer, m As Integer
wLength = Len(sSQL)
For m = 1 To wLength
If Mid(sSQL, m, 1) = "'" Then
sPhrase = sPhrase & "''"
Else
sPhrase = sPhrase & Mid(sSQL, m, 1)
End If
Next
FixApostrophy = sPhrase
End Function

MP

"Jeff" <anonymous@discussions.microsoft.com> a écrit dans le message de
news:0f8701c47b31$8dca5d00$a401280a@phx.gbl...
> I have a text box that allows the user to type in free
> form text. I want to save it to a SQLServer database
> table. If the user types in <Here's Johnny!>, I can insert
> it into SQLServer by inserting the text string <Here''s
> Johnny!>
>
> My question: is there a function that does this, or do I
> process the text string before I insert it to double all
> the appostrophe's?
>
> Thanks!



Relevant Pages

  • Re: Recursive Functions in Excel?
    ... Function CountWords2(sSource As String) As Double ... Dim sPhrase As String ... > Dim sPhrase As String ... > Dim dWords As Double ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Recursive Functions in Excel?
    ... Your recursion doesn't have a way out, and your code as written caused a ... > Function CountWords(sSource As String) As Double ... > Dim sPhrase As String ... > Dim dWords As Double ...
    (microsoft.public.excel.worksheet.functions)