Hello,

Windows NT (sp6)
Access 2000 (9.0.3821 SR-1)
Access Driver 4.00.4403.02 (May be slightly outdated (8/8/99))
Perl 5.6.1
DBI 1.1.4
DBD-ODBC 0.28


The following error occurs when I attempt an insert...

[
Couldn't execute insert statement: [Microsoft][ODBC Microsoft Access Driver]
Syntax error in INSERT INTO statement. (SQL-37000)(DBD:
st_execute/SQLExecute err=-1)
]

I found the problem is tied to the "date" field. Here's a snippet...

[
 my $sth = $dbh->prepare("INSERT into $tbl (employe, project_no, po,
etiq_inv, date) VALUES (?, ?, ?, ?, ?)")
     or &debug_Print("Couldn't prepare insert statement: $DBI::errstr\n") &&
return(0);

 $sth->bind_param(1, $employe);
 $sth->bind_param(2, $project_no);
 $sth->bind_param(3, $po);
 $sth->bind_param(4, $invent);
 $sth->bind_param(5, $date);    ### , {TYPE => SQL_DATE});
]

Notice the column name in the table is named 'date'. I think that's where
the conflict exists.
I've tried passing my values in the execute ($employe, $project_no, etc),
because that will essentially bind them for me. Same result.
As you can see, I also tried defining the SQL datatype, no luck.
I also tried using an alternate name for my var ($date2) in case that was
the problem.

1) Any ideas?

Quick, second, unrelated question :)

2)  I mostly use 'qq' before preparing my statements. Unnecessary, when
using bound parameters correct? Is there risk involved, or is it simply
overkill??

[
my $sql = qq{ (INSERT into $tbl (employe, project_no) VALUES (?, ?))};
my $sth = $dbh->prepare($sql)
......
]

Thanks,

-R-

Reply via email to