Re: Storing appostrophe's in SQL

From: Rob Bovey (Rob_Bovey_at_msn.com)
Date: 08/05/04


Date: Thu, 5 Aug 2004 15:40:47 -0700

Hi Jeff,

    If your code will always be running on Excel 2000 or higher versions of
Excel you can use the VBA Replace function to do this.

    Dim szSQLString As String
    szSQLString = Replace(txtEntry.Text, "'", "''")

-- 
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/
* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
"Jeff" <anonymous@discussions.microsoft.com> wrote in message
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!

Loading