Error making a search system

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

  1. #1

    Default Error making a search system

    Hi all, this is a simple search system to lookup proyects that contains the
    words in the querystring "palabras", but when running the code I get this error

    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'FIRST WORD
    HERE'. <---thats an example heh

    The code is this one, the error ocurrs even if I use single quotes on the
    words


    <cfset palabrasClaves = #URL.palabras#>
    <cfset lineaSQL = "">
    <cfloop index="palabraBusqueda" list="#palabrasClaves#" delimiters = " :/">
    <cfset lineaSQL = lineaSQL & "titulo LIKE " & "'%" & palabraBusqueda & "%'"
    & " OR ">
    </cfloop>
    <!--- Borrar los ultimos 3 caracteres del string lineaSQL --->
    <cfset lineaSQL = RemoveChars(lineaSQL,Len(lineaSQL) - 3,4)>
    <!--- Hacer el query --->
    <cfquery name="busquedaPropuestas" datasource="DNS">
    SELECT * FROM ListadoPropuestas WHERE #lineaSQL#
    </cfquery>

    raulriera Guest

  2. Similar Questions and Discussions

    1. Help with making a Search field
      I would realy appreciate some help. I need to create a search field in my web site and dont know how to create it and link it to seach the site....
    2. System.Net.WebException making web service calls about 10% of the time.
      We are seeing a very frustrating intermittent problem. We are making Synchronious web service method calls from a .NET windows Service using the...
    3. In search of a link making plug-in/utility
      Have a rather large .pdf document, a software manual to be precise, where hot page links or cross-references are a requirement… a 1,000 or more of...
    4. Making Filemaker search smarter
      I have a large database of "Projects", with an even larger related database of "Actions". In Projects, I have a computed field Action Count =...
    5. How can a process consume kernel CPU time without making system calls?
      I'm trying to track down what is going on with a particular rogue application process on a customer site running AIX 4.3.3. Under defined...
  3. #2

    Default Re: Error making a search system

    You need to use PreserveSingleQuotes in the WHERE clause. See code below.



    <cfquery name="busquedaPropuestas" datasource="DSN">
    SELECT * FROM ListadoPropuestas WHERE #PreserveSingleQuotes(lineaSQL)#
    </cfquery>

    jdeline Guest

  4. #3

    Default Re: Error making a search system

    thanks that worked like a charm... you are the man
    raulriera 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