Query of Queries failing in Coldfusion 10

僤鯓⒐⒋嵵緔 提交于 2019-12-11 08:21:36

问题


I'm getting and error when I tried to do a query of query.

Table named allData was not found in memory. The name is misspelled or the table is not defined.

I have an excel document and I'm outputting to a coldfusion var called allData, then I'm doing a query on that var. but I'm getting an error:

What am I doing wrong? The first dump shows the table appropriately.

function name="validateExcel" access="public" output="yes" returnType="void" 
hint="search for dogs">

<cfspreadsheet
 action="read"
 src="#SESSION.theExcelFile#"
 headerrow= "1"
 excludeHeaderRow = "true"
 query = "allData"
 rows = "1-25"/>


  <cfdump var = "#allData#"/>

  <cfset rotCheck = new Query(
        sql =  "SELECT * FROM allData where dogType like '%rot'",
        dbtype = "query"

  ) />

  <cfset dogResult = rotCheck.execute().getResult() />

  <cfdump 
  var = "#dogResult#" />

 </cffunction>

回答1:


(From comments ...)

I have to run, but short answer - the query variable from the spreadsheet is not in scope within the Query.cfc. (The documentation on Query.cfc is somewhat lacking IMO. ) Either pass in the query object as a parameter ie new Query(...., allData=allData) or use a <cfquery> instead.




回答2:


Given that the dump works, the allData variable exists. A cfquery tag with the appropriate attributes will solve your problem for you.



来源:https://stackoverflow.com/questions/21803872/query-of-queries-failing-in-coldfusion-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!