This is going to depend on your DB, if you have created a dat field only
then you need to use the CreateODBCDate. However if you have a datetime
field then use DateFormat() as a variable in two instances.
For example: (And this is off the top of my head)
<cfset DateTimeStart=CreateODBCDateTime("#DateFormat(datestring,"dd/mm/yy")#
00:00:00")>
<cfset DateTimeEnd = CreateODBCDateTime("#DateFormat(datestring#,"dd/mm/yy")
23:59:59")>
SELECT * FROM articles WHERE articleid not like 0
<cfif articletitle is not "">
AND articletitle like '#form.articletitle#%'
</cfif>
<cfif articledate gt 0>
AND ArticleDate between #DateTimeStart# and #DateTimeEnd#
</cfif>
This way you will get all dates regardless of time of creation as well.
regards
Andrew Scott
ANZ eCommerce Centre
* Ph 9273 0693
* [EMAIL PROTECTED]
-----Original Message-----
From: AustralianAccommodation.com Pty. Ltd.
[mailto:[EMAIL PROTECTED]]
Sent: 30 August 2000 16:01
To: [EMAIL PROTECTED]
Subject: Searching records with specific date values
I has an articles database and i am wanting to be able to search the
database for articles that were published on a specified date. The dates are
selected from a drop down list populated from the dates of each record in
the articles table.
The following code is taken from my action page however when ever i pass a
date from the search form to the action page i receive an error message
saying
" Error Diagnostic Information
ODBC Error Code = 22012 (Division by zero)
[Microsoft][ODBC Microsoft Access Driver]Division by zero (null)
Data Source = "citicentre"
SQL = "SELECT * FROM articles WHERE articleid not like 0 AND ArticleDate
like 05/07/00"
"
The action page code is as follws the dates in the search form page appear
using the format of #DateFormat(ArticleDate, 'DD/MM/YY')# may be this is
something to do with the problem
your assistance would be appreciated
<CFQUERY DATASOURCE="citicentre" NAME="articles">
SELECT *
FROM articles
WHERE articleid not like 0
<cfif articletitle is not "">
AND articletitle like '#form.articletitle#%'
</cfif>
<cfif articledate gt 0>
AND ArticleDate like #DateFormat(ArticleDate, 'DD/MM/YY')#
</cfif>
Kind Regards
Claude Raiola (Director)
AustralianAccommodation.com Pty. Ltd.
Website: www.AustralianAccommodation.com
Email: [EMAIL PROTECTED]
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.