Query to a MS-Access 97 database using DBD::ODBC driver

From: Guenter Buehrle (Guenter.Buehrle_at_MarconiSelenia.com)
Date: 01/21/04


To: dbi-users@perl.org
Date: Wed, 21 Jan 2004 16:57:25 +0100

I have problems retrieving data from a Microsoft Access 97 database using
DBD::ODBC.
Using the code
      ...
      $sth = $dbh->prepare("SELECT table.id,table.field FROM table WHERE
(((table.field) Like \'${variable}*\'));");
      $sth->execute;
      $sth->dump_results();
      ...
leads to "0 rows" although there are many rows in the database that match
the given expression!?

First I tried somthing like
    $sth = $dbh->prepare("SELECT id,field FROM table WHERE field Like \'
${variable}*\'");
with the same result.
Looking at the SQL-code used by MS access itself (creating a query at the
MS access 97 frontend and showing the underlying SQL-code)
I tried the more complicated version above.

Why does'nt my query return data? What's going on behind the scene?

Greetings to all out there

p.s
simple queries without using the 'Like <expression>' construct do what they
are expected to do!



Relevant Pages

  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: OT: SQL
    ... query processing. ... FROM Employees e, Employees m, Management mgt ... Manager and Employee Salaries. ... The scheme used does not model database files in general, ...
    (sci.logic)
  • RE: Import external data - web query
    ... Your reply for my query is very extensive, this is for importing a file from ... The data source I want isn't listed in the Select Data Source dialog box. ... information used to connect to a database. ... Check your driver First, make sure you have the right ODBC driver (Open ...
    (microsoft.public.excel.misc)
  • Re: access 2003
    ... I removed the parameters from the form query source. ... boxes from the form header, events, code, etc and ran the form query source ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would be ...
    (microsoft.public.access.conversion)
  • Re: access 2003
    ... I removed the parameters from the form query source. ... synchronize combo boxes to the detail section or the parameter form query ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would ...
    (microsoft.public.access.conversion)