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 |