how to handle single quotation marks

Discussion in 'ASP General' started by new, Jul 8, 2003.

  1. new

    new Guest

    Just wonder how you guys handle the single quatation marks when you
    write the value of a text input into SQL server. Thanks!

    * * * Sent via DevBuilder http://www.devbuilder.org * * *
    Developer Resources for High End Developers.
     
    new, Jul 8, 2003
    #1
    1. Advertising

  2. Double them up.
    www.aspfaq.com/2035


    "new" <> wrote in message
    news:3f0ae6f2$0$203$...
    > Just wonder how you guys handle the single quatation marks when you
    > write the value of a text input into SQL server. Thanks!
    >
    > * * * Sent via DevBuilder http://www.devbuilder.org * * *
    > Developer Resources for High End Developers.
     
    Aaron Bertrand - MVP, Jul 8, 2003
    #2
    1. Advertising

  3. new

    solex Guest

    I wrote a replaceall function to handle this problem and create a DLL with
    common string functions:

    Function ReplaceAll(ByVal Buffer As String, ByVal FindWhat As String, _
    ByVal ReplaceWith As String) As Variant
    '
    ' Replaces all instances of FindWhat with ReplaceWith in the
    ' buffer
    '
    Dim intLenFind As Integer
    Dim intLenReplace As Integer
    Dim intPos As Integer

    If Len(Buffer) = 0 Then
    ReplaceAll = ""
    Else
    intLenFind = Len(FindWhat)
    intLenReplace = Len(ReplaceWith)

    intPos = 1
    Do
    intPos = InStr(intPos, Buffer, FindWhat)
    If intPos > 0 Then
    Buffer = Left(Buffer, intPos - 1) & _
    ReplaceWith & Mid(Buffer, intPos + intLenFind)
    intPos = intPos + intLenReplace
    End If
    Loop Until intPos = 0
    End If

    ReplaceAll = Buffer

    End Function
    "new" <> wrote in message
    news:3f0ae6f2$0$203$...
    > Just wonder how you guys handle the single quatation marks when you
    > write the value of a text input into SQL server. Thanks!
    >
    > * * * Sent via DevBuilder http://www.devbuilder.org * * *
    > Developer Resources for High End Developers.
     
    solex, Jul 8, 2003
    #3
  4. new

    new Guest

    Thank you!

    I was doing a similar thing, by replacing ' to something like @#$% :)

    * * * Sent via DevBuilder http://www.devbuilder.org * * *
    Developer Resources for High End Developers.
     
    new, Jul 8, 2003
    #4
  5. > I was doing a similar thing, by replacing ' to something like @#$% :)

    And then switching it back again, in every single application that connects
    to that table? Ick...
     
    Aaron Bertrand - MVP, Jul 8, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Radith

    Using quotation marks

    Radith, Jan 7, 2005, in forum: Java
    Replies:
    1
    Views:
    443
  2. Replies:
    0
    Views:
    602
  3. Tristan Miller
    Replies:
    54
    Views:
    1,462
    ???????? ????? ???????????
    Nov 6, 2003
  4. M. Clift

    String and quotation marks

    M. Clift, Oct 22, 2004, in forum: Python
    Replies:
    2
    Views:
    379
    M. Clift
    Oct 22, 2004
  5. Peng Yu

    Question about concatenating quotation marks

    Peng Yu, Oct 1, 2004, in forum: C Programming
    Replies:
    3
    Views:
    354
    Mark McIntyre
    Oct 2, 2004
Loading...

Share This Page