Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: MS Access and Win32::ODBC problem

by richardX (Pilgrim)
on Sep 01, 2002 at 14:30 UTC ( [id://194456]=note: print w/replies, xml ) Need Help??


in reply to MS Access and Win32::ODBC problem

I do not use Win32:ODBC, since I have had trouble with it. I use fetchrow_hashref and then I get just the columns I need and push them into my keeper stack. In the following example, Phoophoo is the name of the MS Access database configured under ODBC and X_Master is the name of the table. Here is a snippet of the code that I use:
use DBI; my $dbh = DBI->connect( "dbi:ODBC:phoophoo", "", "", {RaiseError => 1, PrintError => 1, AutoCommit => 1} ) or die "Unable to connect: " . $DBI::errstr . "\n"; my $sql="SELECT col_one FROM X_Master WHERE col_one <> ''"; print "$sql\n" if $VERBOSE; my $sth = $dbh->prepare($sql) || die $dbh->errstr(); $sth->execute() || die $sth->errstr(); while( my $row = $sth->fetchrow_hashref ) { push @new_col, $row->{col_one}; } $sth->finish(); $dbh->disconnect;

Richard

There are three types of people in this world, those that can count and those that cannot. Anon

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://194456]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-29 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found