Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check if a table exist in a dataset
Message
 
To
28/10/2002 07:15:15
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Quebec, Canada
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00715973
Message ID:
00715991
Views:
20
>The code I am using is :
>
>if (MyDataset.Tables.Contains("MyTable"))
>{
> MyDataset.Tables["MyTable"].Clear();
>}
>
>The problem is that even if MyTable exists in the dataset, the program never enter the if because it seems that the if condition is wrong.

Your code is Ok, that's the right way of testing if table "MyTable" exists in dataset MyDataset (and it usually works!)

What problem do you have?
If the expression is always returning false ==> the table does not exist, at least with that name.
If the expression causes an exception, ==> MyDataset is not a valid DataSet object at that point...

Regards
Jose.
------------------
Jose Marcenaro
Tercer Planeta - Argentina
http://www.tercerplaneta.com
Previous
Reply
Map
View

Click here to load this message in the networking platform