in reply to Re: Microsoft Access database control and UPDATE the records
in thread Microsoft Access database control and UPDATE the records

Thanks for the reply. use Win32::ODBC; use DirHandle (); use File::Spec (); use HTTP::Date; $DriverType = "Microsoft Access Driver (*.mdb)"; $DSN = "Win32 ODBC --MAOmaoMAOmaoMAO--"; $Dir = "."; $DBase = "Pitstop_files.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"; $query = "select * from Table1"; !$db->Sql($query) or die "couldn't do $query because ", $db->Error(), "\n"; @directory=""; my %WriteFile; my %WriteTime; while($db->FetchRow()) { #print " YES \n"; my %Data = $db->DataHash(); foreach $key (keys(%Data)) { $query = "UPDATE Table1 SET OldFileName='$WriteFile{$key}', OldFileTime='$WriteTime($key)' WHERE Path='$key'"; $db->Sql($query) or die "couldn't do $query because ", $db->Error(), "\n"; } } I am using this code to update my records but it's not working or it will work for first record. Can anybody send me the code to get the datas and update/change the data in mdb file?
  • Comment on Re^2: Microsoft Access database control and UPDATE the records

Replies are listed 'Best First'.
Re^3: Microsoft Access database control and UPDATE the records
by Jenda (Abbot) on May 15, 2009 at 18:29 UTC

    Do format your posts! The Preview is not there just so that you'd have to click twice!

    And use DBI and DBD::ODBC. Win32::ODBC is fairly old and not really supported and definitely not recommended anymore. Once it was the only way, but that's more than ten years ago!

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.