System.Data.RowNotInTableException

I got this exception for the first time today:

Exception Type: System.Data.RowNotInTableException
Message: This row has been removed from a table and does not have any data.  BeginEdit() will allow creation of new data in this row.
TargetSite: Int32 GetDefaultRecord()
HelpLink: NULL
Source: System.Data

After staring at it for a minute, I realized what I was doing.

Classic case of iterating through Rows collection and trying to call remove on a DataRow found, while still iterating the Collection.  

Now, I temporarily store the DataRow and Remove it after iterating through all the Rows.

6 Comments

Comments have been disabled for this content.