aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

C# - Add/Copy Rows from One Datatable to Another Datatable

Aug 29, 2013

Here I will explain simple
code snippet in c# to add rows from one table to another table in, or copy rows from one datatable to another datatable in  c#,


In Previous posts I explained using statement example in c#, Get all files from folder and subfolders in c#, Export webpage with images to pdf in and many articles relating to
c#,,, Gridview, SQL Server, Ajax, JavaScript etc. Now I will explain how to add rows from one table to another table in c#,,  

To add rows from one table to another table we need to use ImportRow function like as shown below

C# Code

DataTable _dt=new DataTable();
_dt = _ds.Tables[0];
DataTable dt1 = ds1.Tables[0];
for (int i = 0; i < dt1.Rows.Count; i++)

Dim _dt As New DataTable()
_dt = _ds.Tables(0)
Dim dt1 As DataTable = ds1.Tables(0)
For i As Integer = 0 To dt1.Rows.Count - 1

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Give your Valuable Comments

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.