gpt4 book ai didi

coldfusion - 在另一个查询中使用一个查询中的数据时,ColdFusion语法错误

转载 作者:行者123 更新时间:2023-12-03 08:04:42 25 4
gpt4 key购买 nike

我下面有以下代码,该代码应根据学生的 parking 许可证号获取学生信息:

<cfparam name="Permit" default="">

<cfquery name="q_sample" datasource="cars_live">
SELECT * FROM veh_rec WHERE UPPER(DECAL) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#trim(urldecode(UCase(Permit)))#">
</cfquery>

<cfif q_sample.recordcount eq 0>
No Results found for <cfoutput>"#Permit#"</cfoutput>
</cfif>

<cfquery name="s_sample" datasource="cars_live">
SELECT FULLNAME FROM id_rec WHERE ID = #q_sample.ID#>
</cfquery>

<cfoutput query="s_sample">
<p>Name: #FULLNAME#<p>
</cfoutput>

<cfoutput query="q_sample" >
<p>License Plate Number: #license# <br><br> Permit ID Number: #decal#<br><br> Student ID Number: #ID# <br><br> Academic years: #ACADYR#<br><br></p>
</cfoutput>

车牌,许可证ID号等都可以正常使用,但是当我尝试使用#q_sample.ID#标签时,出现语法错误。但是,当我在chrome的控制台窗口中查看错误时,我可以看到它根据许可证号获得了正确的ID。不知道为什么会这样。有人看到我在做什么错吗?

谢谢!

按照要求:

错误:
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.

The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
Error Executing Database Query.

A syntax error has occurred.

The error occurred in /d2/www/vhosts/joeyP.cfm: line 11
9 : 10 : <cfquery name="s_sample" datasource="cars_live">11 : SELECT FULLNAME FROM id_rec WHERE ID = #q_sample.ID#>12 : </cfquery>13 :

VENDORERRORCODE -201

SQLSTATE 42000

SQL SELECT FULLNAME FROM id_rec WHERE ID = 371043>

DATASOURCE cars_live

Resources:

Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.

Browser Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36

Remote Address 10.200.168.210

Referrer http://{redacted}/tests/yup.html

Date/Time 10-Jun-13 09:17 AM

Stack Trace
at cfjoeyP2ecfm876470777.runPage(/d2/www/vhosts/joeyP.cfm:11) at cfjoeyP2ecfm876470777.runPage(/d2/www/vhosts/joeyP.cfm:11)

我正在测试的数字是371043

最佳答案

该查询结尾处有多余的>。如果将其取出,应该可以解决您的问题。

<cfquery name="s_sample" datasource="cars_live">
SELECT FULLNAME FROM id_rec WHERE ID = #q_sample.ID#>
</cfquery>

关于coldfusion - 在另一个查询中使用一个查询中的数据时,ColdFusion语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17025946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com