The first thing you need to do is find out how the date field is defined in the db.

It could be a TIMESTAMP, a DATE or a DATETIME. Each functions very differently.

You can use show to get the structure of the table:

SHOW FULL COLUMNS FROM tbl_name 

this will let you see how the db is currently constructed.

(If you need the rest of the code to return the query and loop through the results, 
let me know)

You are using Mysql. Are you also using the MyODBC driver?

I don't know the truth of the following statement, since I alsways set the date fields 
myself, rather than defaulting, but this comment is on  one of the miriad mysql docs 
mirrors:

Joe <[EMAIL PROTECTED]>: 
For clarity regarding default values, the following two sentences should be added to 
this page... 
Default values must be constants. This means you cannot set the default for a date 
column to be the value of a function such as NOW() or CURRENT_DATE. 
Unfortunately, this dashes my hopes of creating a table that automatically generates 
both a date created and a date modified for each of its records... :( 

Also, there was this note:
``Zero'' date or time values used through MyODBC are converted automatically to NULL 
in MyODBC Version 2.50.12 and above, because ODBC can't handle such values. 


So, if you can let me know what type the date column is, we can work from there.

Jerry


>>> [EMAIL PROTECTED] 12/26/02 02:10PM >>>
We have mySQL database but I didn't set it up myself.  I'll talk to
Kevin (My system guy) when he becomes available and maybe he can show me
how to do this.  We are both learning.

-----Original Message-----
From: Clint Tredway [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 26, 2002 2:02 PM
To: CF-Talk
Subject: Re: New User

Assuming you are using SQL 2K... Go into enterprise manager and go into
the
table design view.

click on your date field and then in the default value field, type
getdate(). Now save your table and your done.

HTH
Clint
----- Original Message -----
From: "Mike Miessen" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, December 26, 2002 12:55 PM
Subject: RE: New User


> How do I set a default date?
>
> -----Original Message-----
> From: Ben Doom [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, December 26, 2002 1:52 PM
> To: CF-Talk
> Subject: RE: New User
>
> 1/1/1900 is the default date in MS SQL 2K (and, I assume, many other
> DBs).
> It sounds like you didn't set a default date when you created the
> column, so
> it's returning the system default.
>
>
>
>   --Ben Doom
>     Programmer & General Lackey
>     Moonbow Software
>
> : -----Original Message-----
> : From: Mike Miessen [mailto:[EMAIL PROTECTED]] 
> : Sent: Thursday, December 26, 2002 1:34 PM
> : To: CF-Talk
> : Subject: RE: New User
> :
> :
> : OK that sounds reasonable I'll try that.  Now I'm trying to add a
date
> : display field but it is returning the same date each time 01/01/1900
> and
> : I know that's not right :)
> :
> : -----Original Message-----
> : From: Timothy Heald [mailto:[EMAIL PROTECTED]] 
> : Sent: Thursday, December 26, 2002 1:25 PM
> : To: CF-Talk
> : Subject: RE: New User
> :
> : You will need to put back in the leading % in case the word they are
> : searching for is in the middle of a title.
> :
> : Example
> :
> : Search string = "Time"
> :
> : Will return = "Time to go"
> :
> : Will not return = "It's Time to go."
> :
> : Also someone else mentioned using upper(), on the column and the
> search
> : string your looking for to get by the case sensitivity of the db, I
> : would recommend you doing it as well.
> :
> : Tim
> :
> : -----Original Message-----
> : From: Mike Miessen [mailto:[EMAIL PROTECTED]] 
> : Sent: Thursday, December 26, 2002 1:15 PM
> : To: CF-Talk
> : Subject: RE: New User
> :
> :
> : I took out the leading % and I dropped the ?TITLE from the action on
> the
> : process button and my query now works.  Thanks to you guys :)
> :
> : -----Original Message-----
> : From: Clint Tredway [mailto:[EMAIL PROTECTED]] 
> : Sent: Thursday, December 26, 2002 12:07 PM
> : To: CF-Talk
> : Subject: Re: New User
> :
> : Take out the leading % and your query will work. With both % in
there
> : this
> : returns everything because to SQL, your string is like everything in
> the
> : database.
> :
> : HTH,
> : Clint
> :
> : ----- Original Message -----
> : From: "Mike Miessen" <[EMAIL PROTECTED]>
> : To: "CF-Talk" <[EMAIL PROTECTED]>
> : Sent: Thursday, December 26, 2002 11:03 AM
> : Subject: New User
> :
> :
> : > I have been trying to do a search of a database.  It is a very
small
> : > testing database and I wrote a search entry form with dream weaver
> : with
> : > one field.  This field should search on the title field of the
> : database
> : > and return results that contain the entry.  I am a raw newbie here
> and
> : > contemplating beating my head against a wall on this.  Well my
query
> : > does not seem to work.  I get all the records returned every time
> not
> : > just the ones that contain the search term.
> : >
> : > Here I was thinking this would be easy.  Boy was I wrong!  Here is
> my
> : > code   Can anyone tell me what I'm doing wrong?  The path to the
> : search
> : > form is
> : >
> : > http://bluegrasspro.net/bluegrasspro/datasources/eventquery.cfm 
> : >
> : >
> : >
> : > <cfquery name="rsTitle" datasource="bluegrasspro" username="LOL"
> : > password="YeaRight" debug="yes">
> : > <cfparam name="TITLE" default="null">
> : > SELECT * FROM bluegrasscalendar WHERE Title LIKE '%#TITLE#%'
> : > </cfquery>
> : >
> : > <html>
> : > <head>
> : > <title>Query Results</title>
> : > <meta http-equiv="Content-Type" content="text/html;
> : charset=iso-8859-1">
> : > </head>
> : >
> : > <body>
> : > <cfoutput query="rsTitle">
> : >             #rsTitle.Title#<br>
> : > </cfoutput>
> : >
> : > </body>
> : > </html>
> : >
> : >
> :
> :
> :
> :
>
> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to