Skip to content

Instantly share code, notes, and snippets.

@cofearabi
Created December 23, 2012 18:26
Show Gist options
  • Save cofearabi/4365075 to your computer and use it in GitHub Desktop.
Save cofearabi/4365075 to your computer and use it in GitHub Desktop.
(Perl) connect the Access mdb and display fields of the table.
#!/usr/local/bin/perl
use Win32::OLE;
$conn = "Provider=Microsoft.Jet.OLEDB.4.0;";
$conn .= "Data Source=c:\\mdb\\addressbook_2007.mdb;";
$db = Win32::OLE->new("ADODB.Connection");
$db->Open($conn);
$rs = $db->Execute("SELECT * FROM アドレス帳テーブル;");
while (!$rs->EOF) {
print $rs->{Fields}->{'漢字氏名'}->{Value},",";
print $rs->{Fields}->{'カナ氏名'}->{Value},"\n";
$rs->MoveNext;
}
$rs->Close();
$db->Close();
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment