/// MBD compact method (c) 2004 Alexander Youmashev /// !!IMPORTANT!! /// !make sure there's no open connections /// to your db before calling this method! /// !!IMPORTANT!! /// /// connection string to your db /// FULL name /// of an MDB file you want to compress. publicstaticvoid CompactAccessDB(string connectionString, string mdwfilename) { object[] oParams;
//create an inctance of a Jet Replication Object object objJRO = Activator.CreateInstance(Type.GetTypeFromProgID("JRO.JetEngine"));
//filling Parameters array //cnahge "Jet OLEDB:Engine Type=5" to an appropriate value // or leave it as is if you db is JET4X format (access 2000,2002) //(yes, jetengine5 is for JET4X, no misprint here)