merging the Mainsoft branch to the trunk
[mono.git] / mcs / class / System.Data / System.Data / DataRowCollection.cs
index d7bee298301bb9257f046d602c8db1e7dd3f3d01..a3cbb45804e42ff47a371aa07769f1472cb1c2ae 100644 (file)
@@ -157,6 +157,10 @@ namespace System.Data
                                        }
                                }
                        }
+                        // Remove from indexes
+                        for (int i = 0; i < this.Count; i++)
+                                this.table.DeleteRowFromIndexes (this [i]);
+
                        List.Clear ();
                }
 
@@ -184,17 +188,17 @@ namespace System.Data
                public DataRow Find (object key) 
                {
                        return Find(new object[]{key});
-               }
+                }
 
                /// <summary>
                /// Gets the row containing the specified primary key values.
                /// </summary>
-               public DataRow Find (object[] keys) 
+               public DataRow Find (object[] keys)
                {
                        if (table.PrimaryKey.Length == 0)
                                throw new MissingPrimaryKeyException ("Table doesn't have a primary key.");
 
-                        if (keys == null)
+                       if (keys == null)
                                throw new ArgumentException ("Expecting " + table.PrimaryKey.Length +" value(s) for the key being indexed, but received 0 value(s).");
                                                                                                     
                        Index index = table.GetIndex(table.PrimaryKey,null,DataViewRowState.None,null,false);