Ask a Question related to Coldfusion Database Access, Design and Development.
-
Supercyberal #1
Searching Dates
Hi Guys
I'm having a problem retriving dates when i use this query:
<cfif Form.TxtDate GT "">
<cfif Form.FindDate EQ "EQUALS">
<cfset WhereClause = WhereClause & " and O_Date = " &
CreateODBCDate(form.TxtDate)>
<cfelseif Form.FindDate EQ "AFTER">
<cfset WhereClause = WhereClause & " and O_Date > " &
CreateODBCDate(form.TxtDate)>
<cfelseif Form.FindDate EQ "BEFORE">
<cfset WhereClause = WhereClause & " and O_Date < " &
CreateODBCDate(form.TxtDate)>
</cfif>
</cfif>
When a type a date, it doesnt bring nothing.
Thank you and waiting for further answers
[]'s
Alvaro Neto
[email]alvaro_galdino@msn.com[/email]
[email]alvaro_galdino@earthlink.net[/email]
Supercyberal Guest
-
WE KNOW EXACTLY WHAT YOU'RE SEARCHING FOR!
:disgust; I am addressing a forum made up of people young enough to be my children and grandchildren - I'm 73, have significant problems, none life... -
name searching
Hello, I want to search for a name in a mysql database. Name-searching can be tricky. Let's say I want to find "Boer". This should match "de... -
Searching on Dates in MySQL
Hello, I have CFM pages with Searching on Dates in MySQL. As you know MySQL Dates are "yyyy-mm-dd" format. However, we want date entering formats... -
Searching in a ?second? adn 'third' datafile
Hi, I have an application which has a main file (in Access) called ASSESSMENTS, which has a subsidiary file called ASSESSCHEM. ASSESSMENTS... -
searching files
I must make a cd-rom with pdf's that must be opened with director. I know have a copy of acrobat reader on the cd. This way I always not the filepath... -
efecto747 #2
Re: Searching Dates
You'd be better of using the DATEDIFF() function (assuming your database has
one which it should).
You code would look something like this:
<cfif Form.FindDate EQ "EQUALS">
<cfset WhereClause = WhereClause & " and DATEDIFF(d,O_Date," &
CreateODBCDate(form.TxtDate) & " = 0">
<cfelseif Form.FindDate EQ "AFTER">
<cfset WhereClause = WhereClause & " and DATEDIFF(d,O_Date," &
CreateODBCDate(form.TxtDate) & " < 0">
<cfelseif Form.FindDate EQ "BEFORE">
<cfset WhereClause = WhereClause & " and DATEDIFF(d,O_Date," &
CreateODBCDate(form.TxtDate) & " > 0">
</cfif>
efecto747 Guest
-
The ScareCrow #3
Re: Searching Dates
I don't think you should be using the follwoing cfif, not really what you want
to do
<cfif Form.TxtDate GT "">
Try
<cfif Len(Trim(Form.TxtDate)>
Or
<cfif Form.TxtDate NEQ "">
Have you dumped the complete query string to ensure it is being constructed
correctly ?
Does the O_Date column only contain dates or dates and Times ?
Ken
The ScareCrow Guest



Reply With Quote

