Thread Access-DB Abfrage mit CGI: Auswertung Access-DB (5 answers)
Opened by axel19071 at 2004-07-15 18:03

renee
 2004-07-15 18:17
#32403 #32403
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code: (dl )
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...
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Access-DB Abfrage mit CGI: Auswertung Access-DB