LINQ QUERY5

Can any one tell me , why I’m not getting .CopytoDatatable at the end of this query?
Sometimes even after getting .copytodatatable, i get an error saying that “Object reference is not set”, why?

(From x In Dt1 Join y In dT2 On x(“NotOnUsCheck”).toString Equals y(“NotOnUsCheck”).toString Select ResultDT.LoadDataRow(New Object(){x(“CashIn”).toString,y(“NotOnUsCheck”).toString},False))

1 Like

May be that time no rows were return, always in a if activity check the count of this query and inside that you can use assign to get the actual results.

I think this linq will return list of boolean values. Please tell me exactly what you want to achieve. Provide sample inputs in excel.

Thanks!

I’m comparing one column of sheet1 and one column of sheet2, if they are equal then copy some columns of sheet1 and sheet2, write them in the sheet3 of same excel.

1 Like

CompareDataTablesReturnBothColumnValues.zip (10.1 KB)

I have compared Column “A” in Both tables. It will return All the column values in new datatable if the condition is true.

Thanks!

Can we do using linq query?

1 Like

Sure, I’ll get back to you as soon as posible. :slight_smile: but it’s completely doable.