Hi,
I am having two tables as below.
I want to join these two datatables using c# linq with studentID as key and want
columns StudentID, StudentName and Course in result datatable.
Hi,
I am having two tables as below.
I want to join these two datatables using c# linq with studentID as key and want
columns StudentID, StudentName and Course in result datatable.
Dt1
Dt2
Join dt
Took only needed columns
Output
Let me know if you are ok with this
Using Linq query method
dt1
dt2
final dt just create column only without any data
Linq query
(From a In dt1.AsEnumerable() Join b In dt2.AsEnumerable() On a(“ID”).ToString Equals b(“ID”).ToString Select dt.LoadDataRow (New Object() { a.Field(Of String)(“ID”),a.Field(Of String)(“Name”),b.Field(Of String)(“Course”)},False)).CopyToDataTable
Check and let me know whether these two methods is helpful or not
Thanks @ganesh4 . Actually I wanted to join tables using C# linq as I have chosen C# language for my uipath flow.
I hope this will work
If this is working, then can you mark the solution and we can close this case?
Hi,
C# expression will be the following. Can you try this?
(from a in dt1.AsEnumerable() join b in dt2.AsEnumerable() on a["StudentID"].ToString() equals b["StudentID"].ToString() select dt.LoadDataRow (new object[] {a.Field<string>("StudentID"),a.Field<string>("StudentName"),b.Field<string>("Course")},false)).CopyToDataTable()
Sample20210723-1.zip (3.1 KB)
Regards,
HI Ganesh, it is working but in VB.Net Uipath project, not in C# Uipath project.
Thanks @Yoichi! Its working.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.