i have two datatables, one datatable containg some part of another datatable i want the rowindex of that particular rows in the main datatable how can i get that
Use foreachrow Activitie of Dt1
–>use get row items (what you need)
→ Use foreachrow Activitie of Dt2
→ use get row items (what you need)
→ use if condition to match the two columns of datatables
→ use counter value to increment and find the index value as you requried
you have to do it with a for each row inside of another for each row.
Call the rows of the first for each → row
Call the rows of the second for each → line
Then, you can check the values using:
if(row(“The name of your column”).toString <> line(“The name of your column”).toString)
→ write Line : “We have a dismatch”
Try this query also
Datatable Final_result = (From x In dt1.AsEnumerable() where (From a In dt1.AsEnumerable() Join b In dt2.AsEnumerable() On a(“Name”).ToString() Equals b(“Age”).ToString() select a).Contains(x) select x).ToArray()
Refer the Link:
I hope it can help you, I guess it is easy to understand.
i can’t do this for 60,000 rows,so query for this would be better
Once Try this Query
DT1.AsEnumerable().Where(Function(row) Not DT2.AsEnumerable().Where(function(r) r("").ToString.Equals(row("").ToString) and row(“Amt”).ToString.Equals(row("").ToString)).Any).ToArray
output count should be rowsindex
case has a potential to do all within a LINQ statement. We can test this on a sample set. May we ask you to share some sample dt1, dt2 and expected outcome result (e.g. Result sample datatable) with us. Thanks
You can also use Join DataTable activity and choose the ones that has an exact match on specific columns that you provide in the activity. In your case, join type should be ‘Inner’.
Hope it works !