Here's some more verbose code:

use strict; use Win32::ODBC; my $DSN = "DRIVER=Microsoft Access Driver (*.mdb);FIL=MSAccess;DriverI +d=25;DBQ=c:\\my documents\\test.mdb"; my $db; my $query = "SELECT * FROM Books"; if (!($db = new Win32::ODBC($DSN))) { print "Error connecting to $DSN\n"; print "Error: " . Win32::ODBC::Error() . "\n"; } if( $db->Sql($query) ) { print "Error executing query [ \"$query\" ]\n"; print "Error: " . Win32::ODBC::Error() . "\n"; } # Debug stuff, to show return results: # $db->DumpData(); while( $db->FetchRow() ) { my %fields = $db->DataHash; print "$fields{'BookID'}: $fields{'Book Title'}\n"; } $db->Close();
I reckon if you added error checking like this, you'd find that you're getting an error connecting to your datasource, and hopefully enough information to solve your problem?

PS: I'd reccomend you create a user account here, and log on with it, as you then get notified when people answer you at logon.

--
RatArsed


In reply to Re (4): MS Access DB and WIN32::ODBC or ADO by RatArsed
in thread MS Access DB and WIN32::ODBC or ADO by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.