Exemplo n.º 1
0
        protected override void ClearProperties()
        {
            dao.Properties properties = App.Application.CurrentDb().Properties;

            //If we delete AccessVersion property the database will be Access 2000 format
            string[] readOnlyProperties = new string[] { "AccessVersion", "Name", "Connect",
                                                         "Transactions", "Updatable", "CollatingOrder",
                                                         "QueryTimeout", "Version", "RecordsAffected",
                                                         "ReplicaID", "DesignMasterID", "Connection" };

            foreach (dao.Property property in properties)
            {
                try {
                    if (!Array.Exists <string>(readOnlyProperties, p => p.Equals(property.Name)))
                    {
                        properties.Delete(property.Name);
                    }
                } catch (System.Runtime.InteropServices.COMException ex) {
                    System.Diagnostics.Debug.Print(String.Format("Property: {0}, Error {1}{2}", property.Name, ex.ErrorCode, ex.Message));
                }
            }
        }