I was to quick in replying:
IsDefined("Category1") ... IsDefined("Category2")
-----Original Message-----
From: Pascal Peters
Sent: maandag 17 december 2001 16:29
To: CF-Talk
Subject: RE: BrainFART: CFQuery conditional excecution
<cfquery name="qCart"
datasource="dsMain"
dbtype="ODBC">
SELECT ItemName, BrandName, RetailEach, RetailUnit, UnitSize,
DetailedDescription, ItemNumber, MainCategory,
SubCategory1, SubCategory2
FROM MasterItemTable
WHERE 0 = 0
<cfif isdefined(#SubCategory1#)>
AND (SubCategory1 = '#SubCategory1#')
<cfelse isdefined(#SubCategory2#)>
AND (SubCategory2 = '#SubCategory2#')
</cfif>
</cfquery>
-----Original Message-----
From: Richard L Smith [mailto:[EMAIL PROTECTED]]
Sent: maandag 17 december 2001 16:19
To: CF-Talk
Subject: BrainFART: CFQuery conditional excecution
Hello,
I trying to get this cfquery to run based on what link the user
clicks, i.e. if the user clicks
"somepage.cfm?SubCategory1=#SubCategory1#" then the first part of the
WHERE should execute else the the OR should execute.
I have tried CFQueryParam to no avail, here is the code
I am using so far.
Rick
<cfquery name="qCart"
datasource="dsMain"
dbtype="ODBC">
SELECT ItemName, BrandName, RetailEach, RetailUnit, UnitSize,
DetailedDescription, ItemNumber, MainCategory,
SubCategory1, SubCategory2
FROM MasterItemTable
<cfif isdefined(#SubCategory1#)>
WHERE (SubCategory1 = '#SubCategory1#')
<cfelse isdefined(#SubCategory2#)>
OR (SubCategory2 = '#SubCategory2#')
</cfif>
</cfquery>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists