[thelist] early mornin' CF/access date tip

Morgan Kelsey morgan at morgankelsey.com
Tue Mar 11 10:39:17 CST 2003



> > Having trouble inserting a NULL value into an Access date
field
> > using ColdFusion?
>
> never
>
> this has always worked for me --
>
>    insert into table_name (date_lastmodified) values ( null )
>
> please note that there are times when an empty string is
valid,
> a null value is wrong, and therefore so is the CPQUERYPARAM
option
> null="Yes"
>
> but when i want a null, i usually use the NULL keyword
>

hmmm, upon further investigation, old and new accept NULL fine.

old version (sorry don't know what version, i'm dealing with
someone else's server) won't accept an empty string  in a date
field, but the new version (2000) will.

old version kicks an error to the effect of "invalid value for
NULL"
which makes sense in hindsight (don't they always....)

in my case, it didn't matter much, as it was for a form wherein
people have 6 possible dates to fill in, though none are
required.
--NULL would be more correct, but '' would make the code
simpler. i always lean toward simpler.

so....what seems to be really going on....

- old version of access won't take an empty string in a date
field. it needs to be a date, or NULL.
- new version (2000) will take a date, NULL, or empty string in
a date field.


nagrom
http://morgankelsey.com




More information about the thelist mailing list