Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check if a table exist in a dataset
Message
 
À
28/10/2002 07:15:15
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Québec, Canada
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00715973
Message ID:
00715991
Vues:
21
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform