How to retrieve only the structure of a DataTable i.e. all the columns?

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

DataTable Clone() method is used for retrieving all the columns a DataTable have.

It only retrieve structure not rows.

For Example:-

DataTable new_dt = new DataTable();

new_dt = dt_employee.Clone();


So,whatever dt_employee Datatable contains columns will be assigned to new_dt DataTable.

Here dt_employee is another DataTable.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response