#! c:\perl\bin\perl use Win32::ODBC; $DriverType = "Microsoft Access Driver (*.mdb)"; $DSN = "Win32 ODBC --MAOmaoMAOmaoMAO--"; $Dir = "c:\\Windows\\system32"; $DBase = "cmsdb.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"; if ($InvoiceNumber eq ""){ $InvoiceNumber = "I111999-0024-A"; } # Use invoice # to index into the Quotes table and get the company ID. I092000-1770-A (I111999-0024-A has a PO) $sqlstatement = "SELECT companyID, quantity1,workordernumber,ponumber,jobname,jobdescription from Quotes where invoicenumber LIKE '$InvoiceNumber'"; !$db->Sql($sqlstatement) 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();