Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does dataset have a column?
Message
De
17/07/2014 22:57:45
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01603979
Message ID:
01603992
Vues:
52
>>>>Hi,
>>>>
>>>>What is the fastest (or an efficient) method to find out if a dataset (not strongly typed) has a column; by name. For example; I have a dataset MyDataSet (created by loading an XML file) and I want to find out if the dataset has column MyColumn.
>>>>
>>>>TIA
>>>
>>>I think that you might want to look at the datatable, rather than the dataset.
>>>The datatable has a columns collection that contains the names of the columns in the table.
>>>You can search the collection or loop through it looking for the column you have in mind.
>>
>>MyDataSet.MyDataTable.Columns("my column") != null
>>
>>But hopefully, they're not typed data sets... LOL
>
>Your suggestion is very close to the solution to my question.
>
>
>if (MyDataSet.Tables[0].Columns["MyColumn"] != null)
>{
>
>}
>
>
>Thank you.


It must've been a wild as guess... I don't know anything according to some here.... lol
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform