Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends,


I looking for how to check column exist or not exist in dataset in best way.
Posted

1 solution

As you know, a populated DataSet is made up of one or more DataTables. Each DataTable contains a Columns collection which contains the list of columns in that DataSet. All you need to do is:
C#
bool isNamePresent = ds.Tables[0].Columns.Contains("NameField");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900