Thank you for your answers, i can't test it now but for now i tried to
update DBD-ODBC from 0.28 to 0.33 from ppm but it didn't work (i use perl
from Active State).
I think i can test it tomorrow.

Bye
Emmanuel

"Jeff Urlwin" <[EMAIL PROTECTED]> a �crit dans le message news:
[EMAIL PROTECTED]
> Emmanuel,
>
> There are two ways to fix that.  It was a bug in DBD::ODBC.  I'm VERY
> surprised I didn't catch it earlier.
>
> 1) Upgrade to the Latest DBD::ODBC (0.33_3)
> or
> 2) use bindings/placeholders for the dates.
>
> > $res = $dbh->do("INSERT INTO SIT_PREVISIONNEL_HISTO (......., DATEMAJ,
> > .....) values (......,$rec->{majdate},.....)
>
> to
> use DBI qw(:sql_types); # important to change your use DBI at the top!
>
> my $sth = $dbh->prepare("INSERT INTO SIT_PREVISIONNEL_HISTO (.......,
> DATEMAJ,
>  .....) values (......,?,.....)
>       $sth->bind_param(1, $rec->{majdate}, { TYPE => SQL_TIMESTAMP });
> $sth->execute;
>
> Jeff
>
> > 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.
> >
> > TIA
> > Emmanuel
>


Reply via email to