Programmatically Compact and Repair Access Example
string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0 ; Data Source=" + mainPath + @"; Jet OLEDB:Engine Type=5; Jet OLEDB:Database Password=XXX;" ; string compactedNewFilePathAndName = mainPath.Replace( ".accdb" , "_TEMP.accdb" ); CompactAndRepair .CompactAccessDB(connectionString, compactedNewFilePathAndName, mainPath); -------------------- -------------------- class CompactAndRepair { /// <summary> /// MBD compact method (c) 2004 Alexander Youmashev /// !!IMPORTANT!! /// !make sure there's no open connections /// to your db before calling this method! /// !!IMPORTANT!! /// </summary> /// <param name="connectionString"> connection string to your db </param> /// <param name="mdwfilename"> FULL name /// of an MDB file you wa