[Zope] can't store a date in Access database

Thomas B. Passin tpassin@mitretek.org
Thu, 25 Oct 2001 12:29:34 -0400


[Micah Martin]

> Whoops, this was a typo.  The code is actually:
>
> insert into TableName (Date) values ("10/24/2001")
>
> I'm still looking for a solution to the problem.
>

Is the name of your table really "TableName"?  This seems unusual.  You need
the actual name of the table.  You also probably need to supply the primary
key or index column value as  well as the date column - definitely if there
is a primary key or an index (there ought to be one, but in Access you can
get away without a primary key).

Finally, you need to use single quotes instead of double quotes around the
date value.  Double and single quotes are not interchangable in SQL.  So if
your table is called "fact_table", and its primary key or index column is
called "the_key" whose value should be 102 for this row, and if the date
field were called "Date", then you would write

insert into fact_table (the_key,Date) values (102,'10/24/2001')

Access will accept this syntax for a dattime field, as I just verified by
checking.

If you mean to be changing an existing date value, you need to use an update
statement instead.

Cheers,

Tom P