CF7 query update with single quote

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default CF7 query update with single quote

    Hi
    i'm migrating an application from CF5 to CF7 (hotfix3) and have the following
    problem:
    the query
    <cfquery...>
    UPDATE t1
    SET f1 = '#var1#'
    </cfquery>

    does not work fine when I have 2 single quote in var1 (let's say var1 = "''")
    in the database (SQL server 2000 sp4) the above query insert 1 single quote
    only
    It seems to me a bug in escaping the single quote

    any suggestion or workaround?

    thanks
    stefano

    achab23 Guest

  2. Similar Questions and Discussions

    1. Single & Double Quote Problem in Database Insert/Update
      Hello, I have a textarea on a form where users are able to enter text wrapped in 'single' and "double" quotes. However, when I insert or update...
    2. SQL insert/update problem if coldfusion field value has single quote
      On the coldfusion form, if the user enter the data with single quote in a field (e.g. Joe's Party), and performs SQL insert or update statements,...
    3. Query of Query with single quote (')
      I have a query object with a last name column. We use query of query against the object. When there's a record with a last name that has a...
    4. Passing Parameters with Single Quote
      I am trying to pass this information to another cfm file. This works fine, except when the name has a single quote (ie. Name = Katie's car). What...
    5. exec, single quote & security...
      Hello, (i'm particulary interested in security issue - php is running on apache + linux) i need to pass the result (here $exp) of a form...
  3. #2

    Default Re: CF7 query update with single quote

    Hi
    found the following fix in CF6.1 - but cannot apply the fix to CF7, of course

    [url]http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_19108[/url]
    ColdFusion MX 6.1: Hot fix for cfquery/cfqueryparam

    Macromedia has created a hot fix to address the following issues with cfquery
    and cfqueryparam in Macromedia ColdFusion MX 6.1:

    53852 - When a string expression is evaluated inside a cfquery tag, each
    single quote character is escaped to two single quotes. In certain cases, such
    as when complex CFML expressions are evaluated in a cfquery tag especially
    within a cfloop, the single quotes may be repeatedly escaped.

    achab23 Guest

  4. #3

    Default Re: CF7 query update with single quote

    Did you ever find a resolution to this problem in CF 7? I am running into the same issue. I found the 6.1 solution as well, but nothing for 7.
    raymacro Guest

  5. #4

    Default Re: CF7 query update with single quote

    Either preservesinglequotes or cfqueryparam should solve your problem.
    Dan Bracuk Guest

  6. #5

    Default Re: CF7 query update with single quote

    :D Worked like a charm. Thanks sooo much!
    raymacro Guest

  7. #6

    Default Re: CF7 query update with single quote

    Please let me know what exactly u did to get around this problem on 6.1 as well as 7 MX.
    TIA
    cfdba Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139