Click here to Skip to main content
15,876,993 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here DTLocal1 and DTLocal1 are two different datatable. Here are used Clone method and ImportRow method. I want to know why we use Clone and ImportRow in the following code snippet. Please explain

DataTable DTLocal1 = DTLocal.Clone();
if (DTLocal.Rows.Count != 0)
    for (int i = 0; i < DTLocal.Rows.Count; i++)

[edit]Code block added[/edit]
Updated 15-Apr-13 0:50am

1 solution

Clone - clones the structure of DTLocal to DTLocal1. No data values are copied.[^]

ImportRow copies the row with data values to DTLocal1.[^]
Share this answer
Sumon562 15-Apr-13 22:48pm    
Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900