Thanks
giving up smoking and just got know brain today :0)
 
 
Kind Regards
Greg Stone
PH: 0411 787 565

 
 
----- Original Message -----
Sent: Tuesday, June 01, 2004 1:51 PM
Subject: [cfaussie] RE: saving date to db

Two problems:

1. "Date" is a reserved word in Access, so should never be used as a
fieldname... Change this to "date_input" or something similar.

then make sure the "date" field is in fact set as datatype "datetime" in
access

2. insert the current date into access like this:
#CreateODBCDateTime(now())# without any single quotes around the
variable (same as your "applied" field.

So your insert query becomes something like:

<cfquery name="addnewsurvey" datasource="#dsn#" username="#dsnUsername#"
password="#dsnPassword#">
 insert into
 survey (cfid,fname, lname, offercode, data, applied, date_input)
 values (#Client.CFID#, '#form.fname#', '#form.lname#',
'#form.offercode#',
'#data#', 1, #CreateODBCDateTime(now())#)
</cfquery>

steve

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, 1 June 2004 1:40 PM
To: CFAussie Mailing List
Subject: [cfaussie] saving date to db


hi
simple but i am stuck
i am having trouble saving date
i am using cf 4.5 win2000 and access.

Code below
<!--- SAVE to WDDX PACKET  --->
<cfwddx action="" input="#surveyanswers#" output="data">

<!--- save to db --->
<cfquery name="addnewsurvey" datasource="#dsn#" username="#dsnUsername#"
password="#dsnPassword#">
 insert into
 survey (cfid,fname, lname, offercode, data, applied, date)
 values (#Client.CFID#, '#form.fname#', '#form.lname#',
'#form.offercode#',
'#data#', 1, '#now()#')
</cfquery>

Error

Error Report
ODBC Error Code = 37000 (Syntax error or access violation)

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.


SQL = "insert into survey (cfid,fname, lname, offercode, data, applied,
date) values (63, '432', '432142314', '65875',
'654363645tiutiu76980984324321423146587598797698National Geographic,New
ScientistYesYesYesYou do not wish to hear from an AUSTRALIAN GEOGRAPHIC
promotional partner,You do not wish to hear from AUSTRALIAN GEOGRAPHIC
againtiusubmit2349869', 1, '{ts '2004-06-01 13:38:26'}')"

Data Source = "AUSGEO"


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004 ---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to