Follow by Email

Thursday, May 23, 2013

To check whether column exists or not in DataTable or Dataset in Asp.net


To Remove a column from DataTable or Dataset in Asp.net

For Dataset:

DataSet ds = new DataSet();
ds = GetData();
ds.Tables[0].Columns.Contains("EmpName");

For DataTable:

DataTable dt = new DataTable();
dt = GetData();
dt.Columns.Contains("EmpName");