1

I have a DataTable. I would like to filter DataRows where City = "Hongkong".

How to apply LINQ against DataRow?

1

3 Answers 3

2

You could use the following Query

var filter = testTable.AsEnumerable().
                       Where(x => x.Field<string>("City") == "HongKong");
Sign up to request clarification or add additional context in comments.

Comments

1
 var result = dr.Where(r => r.Field<string>("City") == "Hongkong");

Comments

0

Using LINQ to DataSets, you can do the following:

DataTable table;

var rows =
    from row in table.AsEnumerable()
    where row.Field<string>("City") == "Hongkong"
    select row;

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.