Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date and Time problem

Status
Not open for further replies.

Dinghus

Programmer
Jan 25, 2001
1
US
I have an Access database with a field of type DATE/TIME and when I try to insert a date I get a data conversion error.

Here is the query, any ideas?

<cfquery name = &quot;add_speaker&quot; datasource=&quot;mydata&quot; dbtype=&quot;ODBC&quot;>
INSERT INTO mytable (
first_word,
last_word,
date_added
)
VALUES (
'My',
'Bad',
<CFQUERYPARAM VALUE = &quot;#CreateODBCDate(Now())#&quot; CFSQLTYPE=&quot;CF_SQL_DATE&quot;>
</cfquery>
 
I think this will fix it.

<cfquery name = &quot;add_speaker&quot; datasource=&quot;mydata&quot; dbtype=&quot;ODBC&quot;>
INSERT INTO mytable
( first_word, last_word, date_added )
VALUES ( 'My', 'Bad', #CreateODBCDate(Now())#)
</cfquery>

GJ
 
You may want to use #CreateODBCDateTime(Now())# instead of #CreateODBCDate(Now())# if you want the current time as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top