Forwarded from dbi-dev, since it belongs here.

-----Original Message-----
From: Sterin, Ilya
To: 'Patricio M. Rueda '; '[EMAIL PROTECTED] '
Sent: 07/11/2001 11:24 AM
Subject: RE: Need some help with DBI/ODBC

Also this should not go to dbi-dev, which is only for DBI
**development**, next time please send to [EMAIL PROTECTED]

Ilya 

-----Original Message-----
From: Patricio M. Rueda
To: [EMAIL PROTECTED]
Sent: 07/11/2001 10:33 AM
Subject: Need some help with DBI/ODBC

Can some one shine the light on this problem.

When I use the  " AS clause"  in my SELECT statement and then try to
print
the table rows by  using the  "ORDER BY tot" statement
(new column "TOT" name),  I get  the following error:

========================================================================
======================================================
DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver]
Too
few parameters.
Expected 1. (SQL-07001)
(DBD: st_execute/SQLExecute err=-1) at
D:\perl\testenv\msdbaccess\access.pl
line 14.
DBD::ODBC::st fetchrow_arrayref failed: (DBD: no select statement
currently
executing err=-1) at D:\perl\testenv\ms
dbaccess\access.pl line 15.
========================================================================
========================================================

Is this an DBI/ODBC problem or is it me not using the API appropriate?
As you can see the example bellow, I am using DBI/ODBC to access a
Microsoft Access Database Tables.


++++++++++++++++++++++++++++++++++++++++++++++++++++++++
use strict;
         use DBI;
         my $dbh = DBI->connect('dbi:ODBC:DNS', '','') || die "Can't
open
database";
         my $sQuery = "SELECT MachineID, AgentID, instanceKey, AgentID +
instanceKey AS TOT
                                FROM dbo_CD_ROM_DATA
                                ORDER BY TOT DESC;";
         eval
                 {
                 my $sthAllABC = $dbh->prepare($sQuery);
                 $sthAllABC->execute;
                 my $raEntry = $sthAllABC->fetchrow_arrayref();
                 while($raEntry)
                 {
                         print "
==========================================\n";
                         print  $raEntry->[0] . "\t" . $raEntry->[1] .
"\t"
.
                         $raEntry->[2] . "\t" . $raEntry->[3] ."\t" .
$raEntry->[4] ."\r\n";

                         $raEntry = $sthAllABC->fetchrow_arrayref();

                 }

                 $sthAllABC->finish;
                 };
         if($@)
                 {
                 print "Query failed because $@\r\n";
                 exit 1;
                 }
         $dbh->disconnect;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Pat

Reply via email to