I’ve facing some issue while comparing two datatables using linq.
I want to update a comment based on comparison and don’t want any row to be eliminated(as in intersect operation)
Query 1 - to add modified rows -
((From i In dt_Datatable_1 where (from l in dt_Datatable_2 where i(“Process”).tostring=l(“Process”).tostring and l(“Modified by”).tostring<>“” select l ).count>0 select dt_Output.Rows.add({i(“Process”).tostring,i(“created by”).tostring,i(“creation time”).tostring,((from l in dt_Datatable_2 where i(“Process”).tostring=l(“Process”).tostring and l(“Modified by”).tostring<>“” select l ).first)(“Modified by”).tostring,((from l in dt_Datatable_2 where i(“Process”).tostring=l(“Process”).tostring and l(“Modified by”).tostring<>“” select l ).first)(“Modified Time”).tostring,i(“Deleted by”).tostring,i(“Deletion Time”),“Modified”}))).copytodatatable
Query2 - to add deleted rows -
((From i In dt_Datatable_1 where (from l in dt_Datatable_2 where i(“Process”).tostring=l(“Process”).tostring and l(“Modified by”).tostring<>“” select l ).count>0 select dt_Output.Rows.add({i(“Process”).tostring,i(“created by”).tostring,i(“creation time”).tostring,i(“Modified by”).tostring, i(“Modified Time”).tostring,((from l in dt_Datatable_2 where i(“Process”).tostring=l(“Process”).tostring and l(“Deleted by”).tostring<>“” select l ).first)(“Deleted by”).tostring,((from l in dt_Datatable_2 where i(“Process”).tostring=l(“Process”).tostring and l(“Deleted by”).tostring<>“” select l ).first)(“Deletion Time”),“Deleted”}))).copytodatatable
Query3 - to add Added rows -
((From i In dt_Datatable_2 where (from l in dt_Datatable_1 where i(“Process”).tostring=l(“Process”).tostring and l(“Modified by”).tostring<>“” select l ).count=0 select dt_Output.Rows.add({i(“Process”).tostring,i(“created by”).tostring,i(“creation time”).tostring,i(“Modified by”).tostring, i(“Modified Time”).tostring,i(“Deleted by”).tostring,i(“Deletion Time”),“Added”}))).copytodatatable