查询在ColdFusion中失败10 [英] Query of Queries failing in Coldfusion 10

查看:272
本文介绍了查询在ColdFusion中失败10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试查询查询时收到错误。


在内存中找不到名为allData的表。


我有一个excel文档,我输出到一个coldfusion变量var allData ,然后我对该var做一个查询。但我收到了错误:



我做错了什么?

  function name =validateExcelaccess =publicoutput =yesreturnType = 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>


解决方案



我必须运行,但简短的回答 - 从电子表格的查询变量不在Query.cfc范围内。 (Query.cfc上的文档有点缺乏IMO。)将查询对象作为参数传递 ie new Query(....,allData = allData)或使用 < cfquery> 改为。


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>

解决方案

(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.

这篇关于查询在ColdFusion中失败10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆