Basically, the <cfset sqlToRun = "..." /> is kind of redundant and negates the benefit of the cfquery tag. Put all you SQL inside the cfquery tag. cfqueryparam is only valid within cfquery tags.
Dominic 2009/6/28 Jason Slack <[email protected]>: > > CF 8.01 OS X. > > I have: > > <cfset sqlToRun = "INSERT INTO personalevent(eventid, userid, username, > eventdate) VALUES(#FORM.eventidentity#, #FORM.whois#, '#FORM.juser#', > '#FORM.eventdate#')"> > > <cfoutput> #sqlToRun# </cfoutput> > > <cfquery name="addpersonaleventtome" dataSource="cf_WikiData"> > #sqlToRun# > </cfquery> > > the <cfoutput> is: > INSERT INTO personalevent(eventid, userid, username, eventdate) VALUES(1, 1, > 'jason', '2009-06-27') > > Which runs fine in a SQL Editor, but running that in the above <cfquery> I > get: > > You have an error in your SQL syntax; check the manual that corresponds to > your MySQL server version for the right syntax to use near '1'', ''1'', > ''jason'', ''2009-06-27'')' at line 1 > > There are a number of extra single quotes that I dont see why. > > If I try converting to <crqueryparam> I have something messed up because I > get an error: > > I did: > <cfset sqlToRun = "INSERT INTO personalevent(eventid, userid, username, > eventdate) VALUES(<cfqueryparam value="#FORM.eventidentity#" > cfsqltype="CF_SQL_INTEGER">, <cfqueryparam value="#FORM.whois#" > cfsqltype="CF_SQL_INTEGER">, <cfqueryparam value="#FORM.juser#" > cfsqltype="CF_SQL_VARCHAR">, <cfqueryparam value="#FORM.eventdate#" > cfsqltype="CF_SQL_DATE">)"> > > and I get an error: Invalid CFML construct found on line 22 at column 120. > > Does anyone see my issue? > > -Jason > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324056 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

