Click here to Skip to main content
15,886,664 members
Articles / Web Development / ASP.NET

How to copy one datatable to another

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
2 Nov 2012CPOL 0  
You may use this code for your task. DataTable dtTarget = new DataTable(); dtTarget = dtSource.Clone(); DataRow[] rowsToCopy; rowsToCopy = dtSource.Select("key='" + matchString + "'"); foreach (DataRow temp in rowsToCopy) { dtTarget.ImportRow(temp); }

Revisions


  

Compare Revision Minor Date Status Editor
2 - publicly available No 2-Nov-12 23:09 Available AshishChaudha
Updates in content.
1 No 2-Nov-12 21:08 Available subhajit Giri

License

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


Written By
India India
Asp.Net Developer

Comments and Discussions