How to copy structure as well as data of a DataTable i.e. all the columns with rows?

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

We can use DataTable'Copy() method to have all the columns as well as rows into another dataTable.

For Example:-

DataTable dt_new = new DataTable();
dt_new = dt_employee.Copy();

Here,dt_employee is our another DataTable which contains Columns as well as Rows.

So here,dt_new DataTable will be assigned with all the Columns and Rows.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response