Esempio n. 1
0
 private static Interop.ITable GetDmoTable(Interop.ITables dmoTables, string name)
 {
     Interop.ITable table = null;
     int count = dmoTables.GetCount();
     for (int i = 1; i <= count; i++)
     {
         table = dmoTables.Item(i, string.Empty);
         if (table.GetName().ToLower() == name.ToLower())
         {
             return table;
         }
     }
     return null;
 }
Esempio n. 2
0
 private static void DeleteInternal(Interop.ITables dmoTables, string name)
 {
     Interop.ITable dmoTable = GetDmoTable(dmoTables, name);
     if (dmoTable != null)
     {
         Interop.IKeys keys = dmoTable.GetKeys();
         keys.Refresh(true);
         int count = keys.GetCount();
         ArrayList list = new ArrayList();
         for (int i = count; i > 0; i--)
         {
             if (keys.Item(i).GetType() == 3)
             {
                 list.Add(i);
             }
         }
         foreach (int num3 in list)
         {
             keys.Remove(num3);
         }
         int num4 = dmoTables.GetCount();
         for (int j = 1; j <= num4; j++)
         {
             Interop.IKeys keys2 = dmoTables.Item(j, "").GetKeys();
             keys2.Refresh(true);
             int num6 = keys2.GetCount();
             ArrayList list2 = new ArrayList();
             for (int k = num6; k > 0; k--)
             {
                 Interop.IKey key2 = keys2.Item(k);
                 if ((key2.GetType() == 3) && SqlHelper.TableNamesEqual(name, key2.GetReferencedTable()))
                 {
                     list2.Add(k);
                 }
             }
             foreach (int num8 in list2)
             {
                 keys2.Remove(num8);
             }
         }
         dmoTable.Remove();
     }
 }