How to Remove particular column from DataTable at specified Index position?

 Posted by vishalneeraj-24503 on 12/20/2013 | Category: ADO.NET Interview questions | Views: 965 | Points: 40
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 

Comments or Responses

Login to post response