How to add data row in different data table of different column using linq

@adarsh_kotagiri Datatable-> DT_1 & DT_Final and Create “Result” argument as “in/out” direction.

In Total 3 Datatable will be used,
DT_1 , DT_Final and Result

Take Involve Code Activity, Pass the DT_1 & DT_Final argument as “in” direction. then open the Code Editor,

Var query = from DT_1 in DT_1.AsEnumerable()
Join DT_Final in DT_Final.AsEnumerable() on DT_1.Field(“Document Number”)
equals DT_Final.Field(“Cheque.no”)
select new

        {
            Date = DT_1.Field<string>("Date")
            Cheque.no = DT_Final<double>("Cheque.no")
            Amount = DT_Final<double>("Amount")
        }

      foreach (var item in query)
    {
        result.Rows.Add(new Object[] {item.Date, item.Cheque.no, Item.Amount})
     }

I am 100% sure it will be work. I have tested it too !!

Happy Learning !!

3 Likes