coldfusion - CF QoQ 抛出运行时错误。 "Column reference is not a column in any of the tables of the FROM table list."

标签 coldfusion coldfusion-8 cfquery

在我的代码中,我首先创建了查询对象:

<cfset memberData = QueryNew('slug,pos,firstname,lastname,email') />
<cfset temp = QueryAddRow(memberData, #numMembers#) />
<!--- LOOP POPULATES QUERY OBJECT --->
<cfloop...</cfloop>

然后,我可以通过运行以下命令(按预期输出)来验证它是否已被填充:
<cfoutput query="memberData">
#slug# - #pos#<br>
</cfoutput>

然后我尝试查询 memberData 查询对象,一切都变得松散了。如果我运行:
<cfquery name="members" dbtype="query">
    SELECT slug,pos,firstname,lastname
    FROM memberData
    WHERE slug = #slug#
</cfquery>

我收到此错误:
Query Of Queries runtime error.
The select column reference [university] is not a column in any of the tables of the FROM table list.

在上面提到的输出测试中,我可以验证“大学”是 slug 列中的值之一。显然我在我的方法中遗漏了一些东西,但我对它可能是什么感到困惑。任何帮助将不胜感激!

最佳答案

Query Of Queries runtime error.
The select column reference [university] is not a column in any of the tables of the FROM table list



您的错误 由 where 子句中没有引号引起的 仅此而已 :

此表达式查找 slug 列中的值等于 CF slug 变量(字符串)中的值的行:
      WHERE slug = '#slug#'

另一方面,此表达式意味着查找 slug 列中的值等于 CF slug 变量(字符串)中命名的列中包含的值的行:
      WHERE slug = #slug#

您需要更改为 SELECT * 的最可能原因是 CF 查询缓存。所以现在改回来应该可以解决问题。 始终使用 <cfqueryparam .../>正如“Al Everett”所建议的那样

关于coldfusion - CF QoQ 抛出运行时错误。 "Column reference is not a column in any of the tables of the FROM table list.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12382961/

相关文章:

sql-server - cfquery 的 blockfactor 真的能提高 MS SQL 服务器的性能吗?

mysql - CFQuery where 子句与查询结果的比较

coldfusion - 如何在 ColdFusion 11 中调用 java 类

java - 从 java 调用 coldfusion 组件

mysql - CF8 - 循环求和

ColdFusion 报告

sql - 为什么 SQL 大小写不起作用

database - 您如何正确地对 ColdFusion 执行时间进行基准测试?

coldfusion - 如何在 cfscript 中创建和使用类/对象?

ant - 无法运行程序 "p4": CreateProcess error=2, 系统找不到指定的文件