PreserveSingleQuotes and Evaluate

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default PreserveSingleQuotes and Evaluate

    Hi all. I've run into a bit of a problem with part of an application. I have
    users inputting , what can be, multiple animal (Species) names and have not
    run into any trouble until, one of the Species they included had an apostrophe
    in its name (Townsend's big-eared bat). Well, that thru my application out of
    whack. Here's what I have going on: <CFLOOP from='1'
    to='#Session.StateRecordNumber#' index='i'> <cfquery
    name='add_ListedSpecies' datasource=#MyDataSource#> INSERT INTO
    PUPOtherSpeciesofConcern (PupNumber, CommonName, ScientificName, StateStatus,
    Comments) VALUES ('#Session.PUPNumber#',
    '#Evaluate('StateSpeciesCommonName' &amp;
    i))#','#Evaluate('Session.StateSpeciesScientificNa me' &amp; i)#',
    '#Evaluate('Session.SpeciesStateStatus' &amp; i)#',
    '#Evaluate('Form.StateComments' &amp; i)#') </cfquery> </CFLOOP> Anyway, if
    I am correct, you can not use PreserveSingleQuotes with Evaluate. How do I go
    about fixing the problem of potential single quotes? Tnx

    herpmaster Guest

  2. Similar Questions and Discussions

    1. evaluate string
      Hi I hve a list mylist= I am inserting the values dynamically in the string format in the list and the list becomes mylist=] or mylist=] now...
    2. Evaluate within CFSET
      I'm looping through a list of sites. I've written queries to count the number of live and pending articles in tables that begin with the site's...
    3. Avoiding Evaluate
      I'm starting with a formula, which is a string, in a variable. For example, calcFormula = (a + b) / c. I replace parts of the string with numeric...
    4. PreserveSingleQuotes Not Working in CFQUERY
      Just a heads up to those for those using CFSCRIPT within a CFQUERY to compose a Dynamic SQL statement. When you try to use...
    5. PreserveSingleQuotes() problem
      Hi, I have a database in which some of the text in it has a single quote, mainly to show posession, such as " cat's ". Anyway, I can't get this...
  3. #2

    Default Re: PreserveSingleQuotes and Evaluate

    You may have to do it in two steps.

    <cfloop...
    <cfset SpeciesName=Evaluate("StateSpeciesCommonName" & i)>
    <cfquery...
    '#PreserveSingleQuotes(SpeciesName)#'

    eastinq 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