At 10:22 AM 10/29/2003 -0600, [EMAIL PROTECTED] wrote:
Can anyone tell me what the Perl driver for MSAccess is called and how to
use it to read a table?

Thanks,

Scott

Scott E. Robinson
SWAT Team
UTC Onsite User Support
RR-690 -- 281-654-5169
EMB-2813N -- 713-656-3629


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Hi Scott,
One way to start with:

First you have to use ODBC to link your Access DB:
Settings-> Control panel-> performance & maintenance -> Administrate tools -> ODBC -System DSN -> add -> 'yourDB'.
Install DBI module if you do not have it, then run your perl prog like this:


#! C:/perl/bin/perl -w

use DBI;
use Error qw(:try);
use strict;

# open conn to Accessdatabase
  my $dbh = DBI->connect('DBI:ODBC:test_clients');
  $dbh->{RaiseError} = 1;

# construct SQL
  my $sqlstatement = "select * from billing";
# prepare and execute SQL statement
  my  $sth = $dbh->prepare($sqlstatement);
  $sth -> execute || die "Could not execute SQL statement, maybe invalid?";

# output database results
while ( my @row = $sth->fetchrow_array)
 {print join ("\t", @row, "\n");}
# simple dump all the results
# $sth->dump_results;
=pod
OR to use hash
while ( my $row = $sth->fetchrow_hashref)
{ print "Client's Name: $row->{ClientName}
         Email Address: $row->{ClientEmail}\n"}
=cut
$sth->finish;
$dbh->disconnect;

__END__

Hope this give you some help,

Shiping




-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to