private static void CheckMdbForDecors(SwAddin mSwAddin, ModelDoc2 inModel, List<ModelDoc2> list, Component2 comp, List<ModelDoc2> faulsModels) { OleDbConnection oleDb; if (mSwAddin.OpenModelDatabase(inModel, out oleDb)) { var oleSchem = oleDb.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" }); if (oleSchem.Rows.Cast<DataRow>().Any(row => (string)row["TABLE_NAME"] == "decors")) { if (!list.Contains(inModel)) list.Add(inModel); } else { if (faulsModels != null && !faulsModels.Contains(inModel)) faulsModels.Add(inModel); oleDb.Close(); if (comp != null) { comp = comp.GetParent(); if (comp != null && !comp.IsSuppressed()) { inModel = comp.IGetModelDoc(); if (inModel != null && mSwAddin.OpenModelDatabase(inModel, out oleDb) && !list.Contains(inModel)) { oleSchem = oleDb.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" }); if (oleSchem.Rows.Cast<DataRow>().Any(row => (string)row["TABLE_NAME"] == "decors")) { if (!list.Contains(inModel)) list.Add(inModel); } oleDb.Close(); } } } } if (oleDb != null) oleDb.Close(); } }