Searching a dataset

mike55

Well-known member
Joined
Mar 26, 2004
Messages
726
Location
Ireland
Is it possible to search a dataset for a particular table, and if you find that table to remove it?

Mike55
 
Found the answer:
Code:
  If Not (dsDataset.Tables(dtName) Is Nothing) Then
     dsDataset.Tables.Remove(dtName)
  End If
 
In C#, checking if a table is null would cause an exception. You should use the Contains method:
Code:
If dsDataset.Tables.Contains(dtName) Then
     dsDataset.Tables.Remove(dtName)
End If

-ner
 
Back
Top