I'm now convinced that the three horsemen of the apocalypse have incarnated
themselves as $subject.

Following situation: I'm using DBI and MS-Access, and my tables contain
"timestamp" fields. I have a number of variables that need to either be
inputted or updated into the table, and my statement looks like this:


#Update: 
$state = "update table set var1 = ?, var2 = ? where primkey = ?" ;

#Insert: 
$state = "insert into table (var1, var2, var3) values(?,?,?)" ;


#Let's assume that var1 is an varchar, var2 is a date/time, and var3
#is an integer.

$var1 = "bla bla bla" ;
$var2 = "2001-8-30" ;
$var3 = 4711 ;

# Since I've already had to deal with inputting longbinaries, I've taken
# the time to determine what data type Access is going to be expecting
# for the various fields, and this information has been jammed into a
# href that has the field names as keys, and the data type as values.
# I then do a manual bind_param on the statement handle for each field.

$sth = $dbh->prepare($state) ;

$sth->bind_param(1, $var1,$data_types->{var1}) ;
$sth->bind_param(2, $var1,$data_types->{var2}) ;
$sth->bind_param(3, $var1,$data_types->{var3}) ;

$sth->execute ;

# This all works just dandy for updates; but inserts bomb out with
# the following trace info:

   -> bind_param for DBD::ODBC::st (DBI::st=HASH(0x19f2668)~0x1b13cf8 7
'2001-8-30' 11)

bind 2 <== '2001-8-30' (attribs: )

bind 2 <== '2001-8-30' (size 16/17/0, ptype 4, otype 1)

    bind 2: CTy=1, STy=TIMESTAMP, CD=16, Sc=16, VM=16.
    <- bind_param= 1 at DBIAnzeige.pm line 115.
    -> execute for DBD::ODBC::st (DBI::st=HASH(0x19f2668)~0x1b13cf8)

    dbd_st_execute (for sql f30285504 after)...
st_execute/SQLExecute error -1 recorded: [Microsoft][ODBC Microsoft Access
Driver]Ung�ltiger Zeichenwert f�r  Konvertierungsangabe. (null)
(SQL-22005)(DBD: st_execute/SQLExecute err=-1)
    !! ERROR: -1 '[Microsoft][ODBC Microsoft Access Driver]Ung�ltiger
Zeichenwert f�r  Konvertierungsangabe. (null) (SQL-22005)(DBD:
st_execute/SQLExecute err=-1)'


After grubbing through the various newsgroups, I've also tried settin $var2
to '{d "2001-8-30" }', but that didn't change anything.


Heyelp!


----------------------------------------------------------------------------
                           Mit den besten Gr��en

                             Carl K. Cunningham
                         Roberts� interactive GmbH
----------------------------------------------------------------------------
Heinrich-Sch�tz-Allee 29     Tel 0561.93893-31   [EMAIL PROTECTED]
34131 Kassel                 Fax 0561.93893-39   http://www.roberts.de
----------------------------------------------------------------------------


Reply via email to