1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! c:\perl\bin\perl
use Win32::ODBC;
$DriverType = "Microsoft Access Driver (*.mdb)";
$DSN = "Win32 ODBC --MAOmaoMAOmaoMAO--";
$Dir = "c:\\meinOrdner";
$DBase = "meineDB.mdb";
Win32::ODBC::ConfigDSN(ODBC_ADD_DSN, $DriverType,("DSN=$DSN", "Description=MAO Win32 ODBC Test DSN for Perl", "DBQ=$Dir\\$DBase", "DEFAULTDIR=$Dir", "UID=", "PWD=")) or die "ConfigDSN(): Could not add temporary DSN" . Win32::ODBC::Error();
$db=new Win32::ODBC($DSN) or die "couldn't ODBC $DSN because ", Win32::ODBC::Error(), "\n";
$query = "select * from table1, table2 where table1.spalte = table2.spalte";
!$db->Sql($query) or die "couldn't do $query because ", $db->Error(), "\n";
while($db->FetchRow())
{
my %Data = $db->DataHash();
foreach my $key(keys(%Data)){
print $key," -> ",$Data{$key};
}
}
Win32::ODBC::ConfigDSN(ODBC_REMOVE_DSN, $DriverType, "DSN=$DSN") or die "ConfigDSN(): Could not remove temporary DSN because ", Win32::ODBC::Error();
Ist jetzt allerdings noch keine HTML-Tabelle...