当前位置: 动力学知识库 > 问答 > 编程问答 >

Have you seen this weird QoQ Error [ColdFusion]?

问题描述:

I have confirmed that the first query works as expected

<cfquery name="validation_info" dbtype="query">

select shipViaName,TOTALSHIPRATE

from s_c_c.qShipCalc

WHERE sku in (#preserveSingleQuotes(validate)#)

</cfquery>

<cfquery name="validation_info2" dbtype="query">

select TOTALSHIPRATE

from validation_info

WHERE shipViaName = "FedEx 3 Day"

</cfquery>

But on the second query, I get this error:

Encountered "shipViaName. Incorrect conditional expression, Incorrect

conditional expression, Lexical error at line 0, column 0.

Encountered: "\"" (34), after : ""

It says the error is happening on this line:

<cfquery name="validation_info2" dbtype="query">

I was also getting this error when I had the two queries combined into one.

Update from comments:

Dump of the validation_info query:

SHIPVIANAME TOTALSHIPRATE

1 | FedEx Ground | 11.9 ||

2 | FedEx 3 Day | 22.99 ||

3 | FedEx 2 Day | 26.99 ||

4 | FedEx 1 Day | 44.55 ||

5 | FedEx Ground | 0 ||

6 | FedEx 3 Day | 23.63 ||

7 | FedEx 2 Day | 26.71 ||

8 | FedEx 1 Day | 41.9 ||

网友答案:

You need to use single quotes instead of double quotes for your string in your second SQL query.

网友答案:

I'd recommend using cfqueryparam for your variables, try this

<cfquery name="validation_info" dbtype="query">
    SELECT      
        shipViaName,
        TOTALSHIPRATE
    FROM        
        s_c_c.qShipCalc
    WHERE       
        sku IN (<cfqueryparam value="#validate#" cfsqltype="CF_SQL_INTEGER" list="yes" /> )
</cfquery>
分享给朋友:
您可能感兴趣的文章:
随机阅读: