How to copy specific column to another datatable, and how to delect duplicated data in the same column

Hi all, I have below question and tried many times but failed, would u kindly help ?

I have three datatable (dt1\ dt2\dt3), dt1 has one column “A1” ,dt2 has one column “B1”, and dt3 has no column. And how can I copy and combine column “GET” & column “EEL” to in the same column in dt3? And how to remove duplicates in dt3 ? Tks.

For example: dt1 & dt2 is my data source, and dt3 is what i want

dt1 HR dt2 Sale dt3 HR
HR Sale

Did you try activities like:
Read Column, Insert Column (for excel) and Remove Duplicate Rows?
There are also activities for datatables like: Merge Data Table.


First we will extract the values of dt1 column into a ListA

List A= (From p In dt1.Select
            Select Convert.ToString(p("ColumnName"))).ToList

First we will extract the values of dt2 column into a ListB

List B= (From p In dt2.Select
                Select Convert.ToString(p("ColumnName"))).ToList

Now Create one Variable LstCollection of type List<List(Of string)

By using Add to Collection Activity, Add these two lists(ListA, ListB) to LstCollection.

List C is a variable of type List(Of String)

List C= LstCollection.SelectMany(Function(x) x).ToList.Distinct.

Build one DataTable dt3

Next Run For Each for List C and update in dt3. and write in Excel by using Write Range Activity.


Tks Mahesh. But I can’t understand how to delete duplicated item in the list. My List_A has 6 item (HR, IT,HR,GMO,IT,SALE).When I use write line [string.Join(",",list_A.Distinct)], showed only 4 item (HR,IT,GMO,SALE) in List_A. Now, I want to make List_C = the distinct of List_A, how to write with assign activity ?

List C= string.Join(",",list_A.Distinct).Split({","},stringSplitOptions.None).ToList


Thank you very much. I figured out another method as well : assign List_C=List_A.Distinct().ToList