Handling apostrophe's in SQL

Results 1 to 3 of 3

Thread: Handling apostrophe's in SQL

  1. #1
    Join Date
    Dec 1969

    Default Handling apostrophe's in SQL

    What is the best way to handle apostrophe&#039;s when a user enters them into a field that will be stored in a data field?<BR><BR>For instance, if a user enter&#039;s their last name as "O&#039;Brian", when I go to update my database with the following query:<BR><BR>Conn.Execute("UPDATE Customers SET LastName=&#039;" & Request.Form("LastName") & "&#039;")<BR><BR>I&#039;ll get a syntax error, because it sees the "&#039;" after the O and before the B in O&#039;Brian as ending the string for the Query.<BR><BR>Is there a good way to handle this?

  2. #2
    Join Date
    Dec 1969

    Default Yep...In fact....

    If you check out the ASPFAQs at the top-right-hand corner of the page, look at the category "Database Queries"...It&#039;s the last article in the category.

  3. #3
    Good Night Guest

    Default use Replace(),see aspfaq..


Posting Permissions

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