If datatable exists...

  • Thread starter Thread starter John Dann
  • Start date Start date
J

John Dann

Is there a simple way to check if a named datatable already exists in
a given dataset in VB.Net? I know I could eg try to add the datatable
again and trap the error but maybe I was wondering if there's a method
akin to File.Exists?

Thanks
JGD
 
John,

Dim dt as DataTable = ds.Tables("table you are looking for")
If dt is nothing then
' table doesn't exist
End If

Ad.
 
Besides John's suggestion you might use also dataset.Tables.IndexOf method.
 
Back
Top