You can't have filters after the Order By Clause
ORDER BY cabinName AND hashottub = 1
You need to move the "AND hashottub = 1" to at the very least just before
"Order By"
That might not be your only problem or the specific cause of this error, but
it definitely will cause you an error eventually.
|-----Original Message-----
|From: P@tty Ayers [mailto:[EMAIL PROTECTED]]
|Sent: Thursday, April 05, 2001 9:58 AM
|To: CF-Talk
|Subject: Re: Newbie problem: Search on Yes/No Column
|
|
|Randy (and/or anyone else willing to help!) -
|
|Thanks very much. But I've trying this exactly the way you've
|shown (code is
|quoted at the very bottom of this message), and I get an error message,
|which I've pasted directly below. Any idea why??
|
|The column name in the database is 'cabinHottub'.. does that
|belong in the
|SQL? I apologize again for these beginner questions.
|
|Again, many thanks for your help.
|P@tty
|
|
|---------------------------------------------------------------
|------------
|ODBC Error Code = 07001 (Wrong number of parameters)
|
|
|[Microsoft][ODBC Microsoft Access Driver] Too few parameters.
|Expected 1.
|
|Hint: The cause of this error is usually that your query contains a
|reference to a field which does not exist. You should verify
|that the fields
|included in your query exist and that you have specified their names
|correctly.
|
|SQL = "SELECT cabins.cabinID, cabins.cabinName, cabins.cabinCity,
|cabins.cabinBedrooms, cabins.cabinBathrooms, cabins.cabinSleeps,
|cabins.cabinNightly, cabins.cabinWeekly,
|photos.photosThumbPhotoName FROM
|cabins INNER JOIN photos ON cabins.cabinID = photos.cabinID WHERE
|cabinDistance <= 200 AND cabinBedrooms >= 1 AND cabinBathrooms >= 1 AND
|cabinSleeps >= 1 ORDER BY cabinName AND hashottub = 1"
|
|---------------------------------------------------------------
|-------------
|------
|
|> You need to assign a value to the Doesn't Matter such as this
|>
|> > <select name="hashottub">
|> > <option VALUE="0" selected>Doesn't Matter</option>
|> > <option value="1">Yes</option>
|> > </select>
|>
|>
|> Then your query would read:
|>
|> > <cfquery name="rs2" datasource=#MM_connAsheville_DSN#
|> > username=#MM_connAsheville_USERNAME#
|password=#MM_connAsheville_PASSWORD#>
|> > SELECT
|> > cabins.cabinID, cabins.cabinName, cabins.cabinCity,
|> > cabins.cabinBedrooms,
|> > cabins.cabinBathrooms, cabins.cabinSleeps,
|> > cabins.cabinNightly,
|> > cabins.cabinWeekly, photos.photosThumbPhotoName
|> > FROM cabins INNER JOIN photos ON cabins.cabinID =
|> > photos.cabinID
|> > WHERE
|> > cabinDistance <= #rs2__vardistance#
|> > AND
|> > cabinBedrooms >= #rs2__varnumberbedrooms#
|> > AND
|> > cabinBathrooms >= #rs2__varnumberbathrooms#
|> > AND
|> > cabinSleeps >= #rs2__varsleepsatleast# ORDER BY
|> > cabinName
|> > <CFIF IsDefined("hashottub") and hashottub NEQ "0">
|> > AND hashottub = 1
|> > </CFIF>
|> > </cfquery>
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists