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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top