in reply to Re: MS Access DB and WIN32::ODBC or ADO
in thread MS Access DB and WIN32::ODBC or ADO

Ok, I don't know if you are going for portability, or if this will
working off of one database for it's existence. If it is, you can
set up an ODBC Connection for the database by using the ODBC icon in
the Control Panel. This will take care of the DSN for you.

I'll test out your code and see what errors I get back and let you know.
  • Comment on RE: Re: MS Access DB and WIN32::ODBC or ADO

Replies are listed 'Best First'.
Re: RE: Re: MS Access DB and WIN32::ODBC or ADO
by Anonymous Monk on Jan 16, 2001 at 07:38 UTC
    i get the following error on my win2k system with the latest version of activestate:
    -==============-
    Can't call method "Sql" on an undefined value at cgi-bin lin e 8.
    -==============-
    i have the code written exactly as it is above, only changing the path to the .mdb file.

      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