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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get the "#" around dataes in an Insert into query?

Status
Not open for further replies.

Ratbags21

Programmer
Sep 21, 2005
22
GB
I am trying to use the "Insert Into" type "CFQUERY" and insert a date into a field.This date has been input by the user on a web form using the syntax "<input type="text" name="DateInTheatres"...>
The query is
<CFQuery datasource="blah">
Insert into Films(<other fields>,DateInTheatres)
values(<other fields>,#CreateODBCDate(Form.DateInTheatres)#)
</CFQuery>
The above code does not seem to work because the "#" are not automatically put to the left & right of the date so when the sql resolves you get 12/10/2009 (for example) no quotes, nothing.
How can I fix this?
many thanks
Paul
 
when the sql resolves you get 12/10/2009 (for example) no quotes, nothing

What do you mean does not work? There should not be any # signs in the output. CreateODBCDate() should produce a specially formatted date value that your database can understand. IIRC, it should looks something like this:

INSERT INTO Films( DateInTheatres )
VALUES( {d '2008-02-14'} )






----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top