IEnumerable<string> 2 conditions

I need help on how to make an IEnumerable list string but with two conditions.

I want to get a list of rows that has match Invoice Number column from dt_Source to dt_Bashing but does not have match Amount column.

INPUT
image

OUTPUT
image

I got this syntax for list of UNMATCHED Invoice Number but I don’t know how to implement a syntax for MATCHED Invoice Number and UNMATCHED Amount in one syntax.

dt_Source.AsEnumerable().[Select](Function(r) r.Field(Of String)("Invoice")).Except(dt_Bashing.AsEnumerable().[Select](Function(r) r.Field(Of String)("Invoice")))

Amount column is/should be Double data type.

Hi,

How about the following expression?

dt_Source.AsEnumerable.Where(Function(rs) dt_Bashed.AsEnumerable.Select(Function(rb) rb("Invoice").ToString).Contains(rs("Invoice").ToString) AndAlso not dt_Bashed.AsEnumerable.Select(Function(rb) rb("Amount").ToString).Contains(rs("Amount").ToString))

Regards,

What data type is this?

Hi,

The above returns IEnumerable<DataRow>. If number of rows of it is larger than 0, we can use CopyToDataTable to convert to datatable.

Regards,