Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Posts
    9

    Unanswered: Error storing varchar with apostrophe

    I'm getting the following error when I try to store
    the name Wendy O'Leary (the name is entered via a text box on an ASP page)

    Microsoft OLE DB Provider for SQL Server (0x80040E14)
    Line 1: Incorrect syntax near 'leary'.

    Posted Data is
    FirstName=wendy+o%27leary&

    Any help would be greatly appreciated
    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Ohio
    Posts
    90
    I've encountered similar problems in VB/Access.

    Here is the simplest workaround:

    Change all "'" to "`" before updating/searching the database.

    It looks almost the same but doesn't generate an error.

    Some databases understand two single quotation marks and will insert/search correctly using O''Leary.

    The users will probably not remember to enter O''Leary when searching.

    Good Luck,
    Bruce Baasch

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    You should use the replace function in visual basic ( or a similar function in another programming language).

    newstring = replace(oldstring,"'","''")

Posting Permissions

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