On 05-Feb-2002 Emmanuel Jaeckert wrote:
> Hi,
> 
> I have some problems using date/time field with DBI and a MS Access Database
> over ODBC.
> 
> I try to insert a record containig a date :
> $res = $dbh->do("INSERT INTO SIT_PREVISIONNEL_HISTO (......., DATEMAJ,
> .....) values (......,$rec->{majdate},.....)
> 
> $rec->{majdate} come from another table and i got it without a problem with
> a SELECT query.
> 
> DBI trace shows that :
> 
> dbd_preparse scanned 2 distinct placeholders
> dbd_st_prepare'd sql f61546664
>  INSERT INTO SIT_PREVISIONNEL_HISTO
>                                 (...,...,...,DATEMAJ,...)
>                                 values (...,...,...2002-02-05 15??,...);
> 2   <- prepare= DBI::st=HASH(0x38b54d0) at DBI.pm line 930.
>     -> execute for DBD::ODBC::st (DBI::st=HASH(0x38b54d0)~0x38b54f4)
>     dbd_st_execute (for sql f61546664 after)...
> st_execute/SQLExecute error -1 recorded: [Microsoft][Pilote ODBC Microsoft
> Access]Champ COUNT incorrect  (SQL-07001)(DBD: st_execute/SQLExecute err=-1)
>     !! ERROR: -1 '[Microsoft][Pilote ODBC Microsoft Access]Champ COUNT
> incorrect  (SQL-07001)(DBD: st_execute/SQLExecute err=-1)'
> 
> i don't know why perl found 2 placeholders where none existed...
> I'm relatively new to perl and i have certainly missed something in the
> syntax.

You need to quote the timestamp with ' to stop the preparse method looking for
placeholders.

Martin
--
Martin J. Evans
Easysoft Ltd, UK
Development

Reply via email to