7 Replies Latest reply on Oct 19, 2009 11:51 AM by -==cfSearching==-

    Single quotes in an evaluate expression

    plarts Level 1

      I need to evaluate a variable which is itself a variable

       

      <cfset val="form.avis_#form.mod_eval#">


      <cfset coment="#evaluate(val)#">

       

      Then my variable "coment" contains "single quotes",

      then this Query bugs, as the single quote is interpreted by SQL as end of value.

       

        <cfquery name="upd_eval" datasource="#stw_article#">
         update mar_evaluation
         set eval_coment='#preservesinglequotes(coment)#'
         where eval_id=#form.mod_eval#
        </cfquery>

       

      I tried also this :

      <cfset val="form.avis_#form.mod_eval#">
        <cfquery name="upd_eval" datasource="#stw_article#">
         update mar_evaluation
         set eval_coment='#evaluate(val)#'
         where eval_id=#form.mod_eval#
      </cfquery>

       

      Same the SQL bugs,

       

      so how to pass single quotes in the evaluate variable ?

       

      For the momentI had to replace single quotes by blanc space to avoid he bug.

       

      Thanks fo answers.

      Pierre.