Marco Dinatsoli
Marco Dinatsoli

Reputation: 10590

C# join two datatables with conditions

I have two datatables, both have a callID column.

I want to join them with condition that the value column is equal to I

I tried this:

var result = from row1 in table.AsEnumerable()
             join row2 in tabelPopup.AsEnumerable()
                on row1.Field<string> ("callID") equals row2.Field<string> ("callID")
             where row1.Field<string>("value") equals "I";

but I got a syntax error

Can't convert string to bool

on the last line of code

Could you help me please?

Upvotes: 0

Views: 1611

Answers (1)

Magnus
Magnus

Reputation: 46997

The last part should be:

where row1.Field<string>("value") == "I"
select something;

Upvotes: 1

Related Questions