17 Replies Latest reply on Dec 21, 2010 9:15 AM by Dan Bracuk

    Query Builder Form

    djkhalif Level 1

      Hi all,

       

      I built a simple query builder form:

       

      <cfif IsDefined('form.query')>
      <cfquery name="queryDemo" datasource="TestProduction">
      #form.goQuery#
      </cfquery>
      </cfif>

      FORM

       

      <ul>
      <cfform name="QueryForm" action="" method="post">
      <li><label>Type Query</label></li>
      <li><cftextarea name="goQuery" cols="100" rows="6"></cftextarea></li>
      <li><cfinput name="query" type="submit" value="Run Query"/></li>
      </cfform>
      </ul>
      <cfif IsDefined('form.query') and queryDemo.recordCount gt 0>
      <cfform action="" name="resultsForm">
      <cfgrid query="queryDemo" griddataalign="center" name="QueryResults" width="700" autowidth="yes" height="700">
      </cfgrid>
      </cfform>
      </cfif>

      When I run a "where" clause such as where type = 'LCR', I get an error. Has anyone tried this before? Please provide insight.

       

      Thanks.