How many ways to clear Columns as well as Rows in DataTable?

 Posted by vishalneeraj-24503 on 12/18/2013 | Category: ADO.NET Interview questions | Views: 2025 | Points: 40
Answer:

We can clear both DataTable Rows and Columns by creating new Objects as well as with the help of Clear() method of Datatable Column/Rows property.

dt_employee.Columns.Clear(); //For clearing Columns

dt_employee.Rows.Clear(); //For clearing Rows
dt_employee = new DataTable(); //For clearing both Columns and Rows


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response