Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Retrieving datarows using DataTable.Select method and adding it to new DataTable
how to do this process...help me Please
Posted
Comments
[no name] 3-May-12 7:42am    
What have you tried?

1 solution

Use the following steps.

  1. Create a blank new DataTable from the DataTable whose data is to be copied using DataTable.Clone method explained here
    http://msdn.microsoft.com/en-us/library/system.data.datatable.clone.aspx[^]
  2. Retrieve the array of DataRows from the DataTable using the Select method explained here http://msdn.microsoft.com/en-us/library/system.data.datatable.select.aspx[^]
  3. Iterate all the rows of the array using a Foreach loop and import each row into the newly created DataTable using ImportRow method explained here
    http://msdn.microsoft.com/en-us/library/system.data.datatable.importrow.aspx[^]
 
Share this answer
 
Comments
Espen Harlinn 3-May-12 8:44am    
5'ed!
VJ Reddy 3-May-12 8:49am    
Thank you, Espen.
Member 8405530 3-May-12 8:45am    
thank u....do u have any sample codings
VJ Reddy 3-May-12 8:54am    
Examples are given at the references given in the solution. Please try yourself using the above references.
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