Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

how to union two datatable

$
0
0

Hi list,

I have two datatable dt1 and dt2, do you know how I can union them together?

DataTable dt1 = new DataTable();

dt1.Columns.Add("col1",Typeof(int));

dt1.Rows.Add(1);

dt1.Rows.Add(2);

DataTable dt2 = new DataTable();

dt2.Columns.Add("col1",Typeof(int));

dt2.Rows.Add(3);

dt2.Rows.Add(4);

Now I want to add dt2 to dt1, which results dt1 as follows:

dt1  where col1 has values of 1,2,3,4

thanks

Arvin


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>