public void MetaData_BeforeActivation() { //Elimina dal combo Column Name i campi già classificati foreach (DataRow Present in SourceTable.Select()) { if (Present["colname"].ToString() == "") { continue; } if (Present == SourceRow) { continue; } string filter = "(tablename='" + Present["objectname"] + "')AND" + "(field='" + Present["colname"] + "')"; DataRow [] todelete = DS.columntypesprincipale.Select(filter); if (todelete.Length > 0) { todelete[0].Delete(); } } DS.columntypesprincipale.AcceptChanges(); //Elimina dal combo RealTable le tabelle non facenti parte della vista DataRow [] AllTB = DS.customobject.Select("objectname<>''"); foreach (DataRow TB in AllTB) { //if (TB["objectname"].ToString()=="") continue; string filter = "(name='dbo." + TB["objectname"] + "')"; if (AllowedColumns.Select(filter).Length > 0) { continue; } TB.Delete(); TB.AcceptChanges(); } }