Hi all,

I can't get a simple query to work in DBI 1.14 / DBD
ADO 1.17 / MDAC 2.6 SP1. Records with specific test
values can be manually added into the Access table no
problem. Deleting these test records and then trying to
have Perl / DBI insert the same records results in a
syntax error and the trace below.

This is such a simple query it has me stumped for the
'Syntax Error' returns. I have several other more
complex INSERTs to other tables working without
complaint. Deleting existing relationships, primary key
(anchor + table unique) and other columns in the table
made no difference.

Thanks in advance.

-Jim

# Schema - doesn't matter if Anchor / table primary
keys or not
Anchor          Text(255)     Required    Zero Length
(No)   Indexed (Dups OK)
Table             Text(255)     Required    Zero Length
(No)   Indexed (Dups OK)

and a query of:

# Slightly modified Cheetah book example on page 99
sub doPrepare {

   # Initialize
   local $anchor = shift;
   local $table  = shift;

   # Sometimes we want to add a record, use
'import=new' to do so
   $sth = $dbh->prepare("
 INSERT INTO htmltables (Anchor, Table)
 VALUES ($anchor, $table)
   "); # or die "Can't prepare statement:
$dbh->errstr\n";

   # Check if statement prepared correctly
   #die "ERROR: Cannot prepare statement:
$DBI::errstr\n" unless (defined $sth);

   # Execute statement at database level
   $sth->execute(); # or die $sth->errstr;

   return;
}

# Trace
    DBI 1.14-nothread dispatch trace level set to 3
    -> prepare for DBD::ADO::db
(DBI::db=HASH(0x1c48710)~0x2325054 '
 INSERT INTO htmltables (Anchor,Table)
 VALUES (testanchor,testtable)
   ')
    New DBI::st (for DBD::ADO::st,
parent=DBI::db=HASH(0x2325054), id=)

dbih_setup_handle(DBI::st=HASH(0x232d3f0)=>DBI::st=HASH(0x232d3e4),
DBD::ADO::st, 232d3fc, Null!)
    dbih_make_com(DBI::db=HASH(0x2325054),
DBD::ADO::st, 172)
    <- prepare= DBI::st=HASH(0x232d3f0) at
dbi_test_query.pl line 70.
    -> execute for DBD::ADO::st
(DBI::st=HASH(0x232d3f0)~0x232d3e4)
    !! ERROR: 1 'Can't execute statement '
 INSERT INTO htmltables (Anchor,Table)
 VALUES (testanchor,testtable)
   ': -2147217900: OLE exception from "Microsoft OLE DB
Provider for ODBC Drivers":

[Microsoft][ODBC Microsoft Access Driver] Syntax error
in INSERT INTO
statement.

Win32::OLE(0.15) error 0x80040e14
    in METHOD/PROPERTYGET "Execute"
-2147217900: '
    <- execute= undef at dbi_test_query.pl line 79.
    -- DBI::END
    -> disconnect_all for DBD::ADO::dr
(DBI::dr=HASH(0x1cb8644)~0x1c48734)
    <- disconnect_all= undef at DBI.pm line 450.
    -> DESTROY for DBD::ADO::db
(DBI::db=HASH(0x2325054)~INNER)
    <- DESTROY= undef during global destruction.
    -> DESTROY for DBD::ADO::st
(DBI::st=HASH(0x232d3e4)~INNER)
    <- DESTROY= undef during global destruction.
    -> DESTROY for DBD::ADO::dr
(DBI::dr=HASH(0x1c48734)~INNER)
    <- DESTROY= undef during global destruction.
    <> DESTROY for DBI::db=HASH(0x1c48710) ignored
(inner handle gone)
    <> DESTROY for DBI::st=HASH(0x232d3f0) ignored
(inner handle gone)
    <> DESTROY for DBI::dr=HASH(0x1cb8644) ignored
(inner handle gone)


Reply via email to