Ask a Question related to Coldfusion Database Access, Design and Development.
-
Beards247 #1
passing SQL in a variable
In a nutshell, user selects a bunch of radio buttons to search. On the next
page, I try to put that information into queryable form:
<cfif frm_int_interest_ind neq "">
<cfset search_frm_int_interest_ind = "(">
<cfloop index="el" list="#frm_int_interest_ind#">
<cfset search_frm_int_interest_ind = "#search_frm_int_interest_ind#'#el#',">
</cfloop>
<cfset len_search_frm_int_interest_ind = "#len(search_frm_int_interest_ind)#">
<cfset search_frm_int_interest_ind = "#Left(search_frm_int_interest_ind,
evaluate(len_search_frm_int_interest_ind - 1))#">
<cfset search_frm_int_interest_ind = "#search_frm_int_interest_ind#)">
<!--- Now that the list is properly formatted, set up the query string --->
<cfset queryvariables = "AE_int.int_interest_ind
in#search_frm_int_interest_ind#">
</cfif>
<cfquery name="Entrepreneur_Int_search" datasource="#AlumDS#">
SELECT *
FROM Alumni A JOIN Alumni_Entrepreneur_Int AE_int
On A.User_Login = AE_int.User_Login
Where
#queryvariables#
</cfquery>
The error that gets returned is: Diagnostics: ODBC Error Code = 37000 (Syntax
error or access violation)
Line 6: Incorrect syntax near '1'.
The cfdump (and cfoutput) of #queryvariables# is:
AE_int.int_interest_ind
in('1','2','3','4','5','6','7','8','9','10','11',' 12','13','14','15','16','17','
18','19','20','21','22','23','24','25')
which I can cut and copy into the cfquery tag and execute just fine.
I assume something is wrong with the #queryvariables# format, but trying
evaluate or de has not worked.
Also, if there is a more elegant way to handle building the sql, I'd
appreciate the suggestion(s).
Thanks,
Chris
Beards247 Guest
-
Passing a variable to asp
I cannot work out how to get the variable namefirst from flash to the asp I use : ... -
URL Variable Passing
First off, a disclaimer - I'm new to Cold Fusion and not well versed in all that it is capable of. I am trying to use a <cfformitem> tag to put an... -
passing variable
Hello, Hopefully somebody can assist my with my issue. Basically I have simply form the asks users for the registration number, security word,... -
Passing a second value in a variable
Two or querysting variables can be passed by separateing them with an ampersand: page.asp?p1=1&p2=2 HTH, Bob Barrows Raphael Gluck wrote: -
passing javascript variable into asp variable using vbscript
The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script... -
Dan Bracuk #2
Re: passing SQL in a variable
The PreserveSingleQuotes function will probably work.
Dan Bracuk Guest
-
Beards247 #3
Re: passing SQL in a variable
That is exactly what I was looking for! Thank you!
Beards247 Guest



Reply With Quote

