Ask a Question related to Coldfusion Database Access, Design and Development.
-
xSist #1
Passing a variable to a query
<cfset ctr=1>
<cfloop list="#query1#" index = "i" delimiters = ",">
<cfset thisColumn = "subcat_"&#ctr#>
<cfquery name="insertNodes" datasource="#dsn#">
INSERT into maintank
(.....)value('#i#')
</cfquery>
<cfset ctr=ctr+1>
</cfloop>
keep getting "subcat_1 does not exist".
evaluate()? - ThankYou
xSist Guest
-
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... -
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 variable to a URL
Hello, I want to have an input field that writes to, say, "input1" input at the beginning of the movie, and then all hyperlinks clicked on from... -
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... -
jdeline #2
Re: Passing a variable to a query
I see where subcat_1 is constructed; where is it (or thisColumn) used?
jdeline Guest
-
JaredJBlackburn #3
Re: Passing a variable to a query
Please post the error that you're getting. I'm curious if it's a CF error complaining that a variable doesn't exist or a SQL error complaining that a column doesn't exist.
JaredJBlackburn Guest
-
xSist #4
Re: Passing a variable to a query
.... clarifying, sorry
if I use
<cfquery ...
(#evaluate(thisColumn)#)value('#i#')
I get the error : "Variable subcat_1 is undefined. "
using :
<cfquery ...
(#thisColumn#)value('#i#')
I get the error : " Error Executing Database Query. Syntax error in INSERT
INTO statement. "
ThanYou
xSist Guest
-
xSist #5
Re: Passing a variable to a query
.... found and duly noted. It should be:
INSERT into maintank
(#Evaluate("subcat_#i#")#)value('#i#')
BUT
#i# should be one of the elements of the list
"1036592|Apparel & Accessories,1036682|Departments"
comma delimited
and I get the error: "Invalid token '|' found on line ..."
It looks like a CF error ...
xSist Guest
-
JaredJBlackburn #6
Re: Passing a variable to a query
When you use (#evaluate(thisColumn)#)value('#i#'), CF is concatinating the
strings 'thisColumn' and '1' and then trying to evaluate the resulting string
'thisColumn1' as if it were a CF variable. Since you have no CF variable by
that name, it's giving you an error.
The second way appears to be closer to what you want. Here, the CF server
isn't crashing, but the SQL server is returning an error when it tries to
handle your cfquery call. First, if you haven't already, turn on your debug
output and see what SQL statement you're actually sending to the SQL server.
The error message indicates that it's a syntax error which is probably just
some type-o in the resulting SQL.
JaredJBlackburn Guest
-
-
xSist #8
Re: Passing a variable to a query
ThankYou "jdeline" and "JaredJBlackburn".
Got it to work, but it was much worse than what you have read.
I swear I didn't drink and worls soccer Italy is ahead of Ghana so far.
I am under heavy loads or full moons.
All the best.
ContiW
xSist Guest



Reply With Quote

