two DataTables, DT1 and DT2. In DT1, there are multiple rows, and I want to retrieve the entire rows from DT1 where the data in the “NUMBER” column matches the data in the “NUMBER” column of DT2.
I attempted to use the following code:
DT.AsEnumerable().Where(Function(r2) input.AsEnumerable().Any(Function(r1) DataRowComparer.Default.Equals(r1, r2))).CopyToDataTable()
However, I encountered the error “Read DT all Assign: No DataRow in the source.”
I would appreciate any help with the code!
You can try like this…first to avaoid the no rows situation before copytodatatable use .Count>0 in if condition and on then side use the .CopyToDatatable and on else side that means there are no matches found