First of all, while inserting dates, be sure field is set up as a date/time
field. Then, if you are using an ms access database, you must not use single
quotes.

insert into tablename (username, password, createDate)
values ('#Form.UserName#', '#Form.Password#', #CreateODBCDate(Now())#)

also you don't format the dates while inserting or updating them to the
database. Instead, you format them while outputting:

<cfoutput query="xyz">#DateFormat(CreateDate,'dd mm yyyy')#</cfoutput>

There is well written sql tutorial at

www.sqlcourse.com

that you should check.


----- Original Message -----
From: "Dusty Tinashe Shoko" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 4:06 PM
Subject: SQL


> People help
> <CFQUER datasource="mydbsource">
>     INSERT INTO TABLENAME (Field1, Field2, Field3,....)
>     VALUES ('Value1', 'Value2', 'Value3',...)
> </CFQUERY>
>
> Is that the proper syntax?
> Sp Field1 is a date got from the form how would I make sure it is inserted
in a format I like? Can I do a dateformat within the query?
> I am getting a syntax error!
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to