Thread Platzierung Pfadangabe bei DBD unklar
(18 answers)
Opened by geloescht at 2012-09-15 00:25
Hallo nochmal,
Habe diesen Lerncode versucht: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #!/usr/bin/perl use strict; use warnings; use DBI; # Connect to the database, (the directory containing our csv file(s)) my $dbh = DBI->connect("DBI:CSV:f_dir=../prospects.csv;csv_eol=\n;"); # Associate our csv file with the table name 'prospects' $dbh->{'csv_tables'}->{'prospects'} = { 'file' => 'prospects.csv'}; # Output the name and contact field from each row my $sth = $dbh->prepare("SELECT * FROM prospects WHERE name LIKE 'G%'"); $sth->execute(); while (my $row = $sth->fetchrow_hashref) { print("name = ", $row->{'Name'}, " contact = ", $row->{'Contact'}. "\n"); } $sth->finish(); Das ergab immer diesen Fehler: Quote Die CSV-Datei sieht so aus: Quote Scheint als wär das Verbinden mit DBI oder DBD:CSV gar nicht so einfach. Gruss und Gute Nacht HP-User Past brought us "SYS 64738". Present brought us "ctrl+alt+del". But what will future bring?
|