|
you
have probably solved this by now, but here goes anyway:
<cfset Form.age = 5>
<!--- set age diff ---> <cfset Older = Form.age + 2> <cfset Younger = Form.age - 2> <!--- create the dates
--->
<cfset Olderthan = dateformat(DateAdd("yyyy", -Older, Now()),'yyyy-mm-dd')> <cfset Youngerthan = dateformat(DateAdd("yyyy",-Younger,Now()),'yyyy-mm-dd')> <!--- get all records where member was born between #Olderthan# and #Youngerthan# ---> <cfquery name="getRecord" datasource="interact"> SELECT Talent.talentID , Talent.Name , Talent.Gender , Talent.DOB , Talent.Hair , Talent.Eye , Talent.Height , Talent.Clothessize , Talent.shoesize , Talent.hobbies , Talent.BIO , Talent.Compcard , Talent.ID FROM Talent where (Talent.DOB <= {d '#Olderthan#'} and Talent.DOB >= {d '#Youngerthan#'}) </cfquery>
take
note of the positioning of the squiggly brackets "{ }" as opposed to the normal
brackets "( )"
steve
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, 19 March 2003 10:09 PM To: CFAussie Mailing List Subject: [cfaussie] New look up date by years old with a 2 year spread < 2 > 2
|
Title: Message
Error Occurred While Processing Request
Error Diagnostic InformationODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
SQL = " SELECT Talent.talentID ,
Talent.Name ,
Talent.Gender ,
Talent.DOB ,
Talent.Hair ,
Talent.Eye ,
Talent.Height ,
Talent.Clothessize ,
Talent.shoesize ,
Talent.hobbies ,
Talent.BIO ,
Talent.Compcard ,
Talent.ID
FROM Talent
where Talent.DOB between ('{ts '1996-03-19 22:06:56'}') and ('{ts '2000-03-19 22:06:56'}')
"
Data Source = "INTERACT"
The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (16:1) to (16:48) in the template file C:\Documents and Settings\Greg Stone.GREG\My Documents\client coldfusion workfiles\interact\application\members\test.cfm. --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ |
