use Win32::ODBC;
use warnings;

my $DSN;
$DSN = "GILES RESEARCH FOR PERL";
        my $GILES_RESEARCH;
        $GILES_RESEARCH = new Win32::ODBC("DSN=$DSN;
                                                        UID=XXX;
                                                        PWD=XXX;") or 
        die "Error connecting to GILES RESEARCH database" .
Win32::ODBC::Error();
        print "Establishing connection to GILES RESEARCH database: OK \n";

if      (! $GILES_RESEARCH->Sql ("select * from tblMain") )
        {
                while ( $GILES_RESEARCH -> FetchRow() )
                {
                        $Row++;
                        print "$Row \n";
                        my ( %NAMES ) = $GILES_RESEARCH->DataHash( "ID",
"FIRST_NAME", "MIDDLE_NAME", "LAST_NAME");
                }
        }
foreach $ID (sort keys %NAMES)
        {
        print "$ID => $NAMES{$ID} \n";
        }

The connection to my access database takes place just fine.  And I think
it's safe to assume that the SQL statement is being passed just fine as
well, because "$Row++;" and "print "$Row \n";" prints 878 numbered lines,
which is exactly how many observations there are in the table.

The problem is this:  I get no errors, and "print "$ID => $NAMES{$ID} \n";"
does nothing for me.  ID does exist as a variable in tblMain.  Why isn't
perl showing me my data?!?  ANY HELP WOULD BE APPRECIATED.

Best, Doug Cacialli

-------------------------------------------
Doug Cacialli - Data Manager / Data Analyst
Depression Research Laboratory
University of Rochester Medical Center
300 Crittenden Boulevard - Box PSYCH
Rochester, New York 14642
Phone: (585)273-3309 Fax: (585)506-0287
-------------------------------------------

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to