0

I have a dataset containing some tables. When I check that a particular table is contained in the dataset (which it is) System.Data throws a RowNotInTableException error with the 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."

I would expect Tables.Contains to return a boolean (in this case true) why is it throwing an exception?

TablesContains

The right hand side of the above image shows the detail of the dataset being checked.

majjam
  • 1,286
  • 2
  • 15
  • 32
  • I've found a workaround (though I still don't know why this was happening) here: http://stackoverflow.com/questions/29169908/winforms-if-statement-not-working/29370771#29370771 – majjam Mar 31 '15 at 14:16

1 Answers1

0

there are two overloads for Dataset.Table.Contains method

1) Contains(name As String) Gets a value that indicates whether a DataTable object with the specified name exists in the collection.

2) Contains(name As String, tableNamespace As String) Gets a value that indicates whether a DataTable object with the specified name and table namespace exists in the collection.

Both have Datatable "Name" as a parameter. So please pass datatable name as a paramter and check.

Pankti Shah
  • 133
  • 1
  • 4