Steve,
You either need to quote your date field in the insert query just like
the events field, or you need to cfparam it such as
<cfif IsDefined("FORM.Events") AND #FORM.EventDate# NEQ "">
<cfqueryparam cfsqltype="varchar" value="#FORM.Events#"/>,
<cfqueryparam cfsqltype="timestamp" value="#FORM.EventDate#"/>
<cfelse>
My preference is to use the queryparam methods as they avoid troubles
with people using apostrophes in event names and also guards against
sql injection. Especially since you're inserting data straight from a
form.
On 4/19/07, Steve LaBadie <[EMAIL PROTECTED]> wrote:
> Date is not formatting properly. I get "12/30/189905/11/2006"
>
> I enter a date of 04/18/2007 and it takes the previous date entered into the
> database and displays it again with next entry and adds 12/30/1899. The
> datatype in database is set to Date/Time.
>
> <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
> <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ
> "frmAddEvents">
> <cfquery datasource="member_login">
> INSERT INTO Events (Events, EventDate)
> VALUES (
> <cfif IsDefined("FORM.Events") AND #FORM.EventDate# NEQ "">
> '#FORM.Events#', #FORM.EventDate#
> <cfelse>
> NULL, NULL
> </cfif>
> )
> </cfquery>
>
> <form action="<cfoutput>#CurrentPage#</cfoutput>" method="post"
> name="frmEvents" id="frmAddEvents">
> <input type="text" name="eventDate" id="eventDate" size="15" maxlength="10"
> class="formveld" />
> <textarea name="events" cols="70" rows="10" id="events"
> class="formveld"></textarea>
> <input name="Reset" type="reset" id="Reset" value=" Reset " class="formveld">
> <input name="Submit" type="submit" id="Submit" value=" Submit "
> class="formveld">
> <input type="hidden" name="MM_InsertRecord" value="frmAddEvents">
> </form>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7.
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275911
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4