use strict; use DBI; # mdb 資料庫 my $mdb = 'C:/access.mdb'; # SQL 語法 my $sql = 'select * from notifications'; # 連線到資料庫 my $dbh = DBI->connect("dbi:ODBC:driver=microsoft access driver (*.mdb);dbq=$mdb"); # 執行 SQL 語法 my $sth = $dbh->prepare("$sql"); $sth->execute || die " Could not execute SQL statement ... maybe invalid?"; # 顯示出結果 while (my @row = $sth->fetchrow_array()){ print "@row"; }
留言