Thanks Paul,

But isn't there any built in function to perform this task?

Vineet Garg.

-----Original Message-----
From: Paul Kukiel [mailto:[email protected]] 
Sent: Wednesday, September 23, 2009 7:37 PM
To: cf-newbie
Subject: RE: How do I put the form variables in quoted value list to make it 
usable in SQL query


This may help.

 

You can use this to loop over the variables in a form:

 

<!--- dummy form data --->

<cfset form = {} />

<cfset myList = "" />

<cfset form.var1 = "Name" />

<cfset form.var2 = "LastName" />

 

<!--- Bild a csv list --->

<cfloop collection="#form#" item="key">

      <cfset myList &= form[key] & "," />

</cfloop>

 

<!--- drop the last " , " --->

<cfset myList = left(myList,len(myList)-1) />

 

Also remember to use cfqueryparam.

.. and column IN <cfqueryparam list="true" cfsqltype="cf_sql_varchar"
value="#myList#" />

 

Paul.

http://blog.kukiel.net

This message and the information contained herein is proprietary and 
confidential and subject to the Amdocs policy statement,
you may review at http://www.amdocs.com/email_disclaimer.asp


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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-newbie/message.cfm/messageid:4821
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to