SQL bombs on unique characters

Results 1 to 4 of 4

Thread: SQL bombs on unique characters

  1. #1
    Join Date
    Dec 1969
    Posts
    1,324

    Default SQL bombs on unique characters

    I know I saw somewhere how to "protect" a SQL statement from odd characters. Right now if someone adds an apostrophe in our "comments" field the SQL statement gets messed up. Any thoughts?<BR><BR>thank you!

  2. #2
    Join Date
    Dec 1969
    Posts
    13

    Default RE: SQL bombs on unique characters

    In SQL the apostrophe indicates string<BR>i.e.<BR>In VB : strMyString="string"<BR>in SQL : kolumn = &#039string&#039<BR><BR>This is why you can&#039t use "&#039" in a string in SQL<BR>Use the REPLACE-command to replace "&#039" with something else.<BR><BR>Hope it helped you out.

  3. #3
    Shawn Clabough Guest

    Default RE: SQL bombs on unique characters

    Replace the apostrophes with two apostrophes by using the function: strMemo = Replace(Request.form("strMemo"), "&#039", "&#039&#039"). In the database, two apostrophes become one.<BR><BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    1,324

    Default RE: SQL bombs on unique characters

    Thanks for the tip.. I ended up adding the replace command...<BR>Comment = replace(Comment,"&#039","&#039&#039") <BR>... and it worked fine!<BR><BR>Steve


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •