Answer: With the help of RemoveAt() method of DataTable' Column property,we can remove any column from specified index position.
For Example:-
DataTable dt_employee = new DataTable();
dt_employee.Columns.Add("Employee_Code");
dt_employee.Columns.Add("Address");
dt_employee.Columns.RemoveAt(0); //where 0 is the first position,so it will remove Employee_Code
Now,the dt_employee dataTable have only one coulmn as Address.
Asked In: Many Interviews |
Alert Moderator