PARSING A QUERY OF QUERY WITH A VARIABLE VALUE
Posted: 09-15-2006, 04:39 PM
SelectedProject:
<cfset SelectedProject = '<cfoutput>#ArrayGroupAwards[8]#</cfoutput>'>
I've tried whichever way to tease relevant data from my database by
making the selected project a necessary condition for the data to
qualify for inclusion. Here's one example:
Query Of Queries syntax error.
Encountered "Project. Incorrect conditional expression, Incorrect
conditional expression, Lexical error at line 0, column 0. Encountered:
"\"" (34), after : ""
The error occurred in
C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
line 414
Called from
C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
line 1
Called from
C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
line 414
Called from
C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
line 1
412 : SELECT Project, FirstName, LastName
413 : FROM Nominations
414 : WHERE Project = "#SelectedProject#"
415 : </cfquery>
416 : <cfset counter = 0 />
(Of course it works when I substitute the value of #SelectedProject# in
the place of the variable. I just don't know how to the programming
code substitute it in the WHERE statement so that it works.)
As witnnessed by the following code line, my ColdFusion debugger
somehow knows the properly parsed name of the project passed to the
second page and even shows it in the WHERE statement:
SQL SELECT Project, FirstName, LastName FROM Nominations
WHERE Project = "<cfoutput>Fox River Team </span></cfoutput>"
Why then am I getting the error?
I have also tried, among other things,
WHERE Project IN (<cfqueryparam cfsqltype="cf_sql_longvarchar"
value="#SelectedProject#" list="yes" separator=",">)
This does not result in an error, but in no results being displayed at
all.
Can you, would you help? Thanks.



Linear Mode


Posts: n/a