I want to perform a LINQ query on a datatable called Records and check if a record exists. If it exists, I want to find out the row which it is in. How might I go about doing this?
I wanted to do a .where on my datatable after adding the system.linq namespace but the method didnt seem to exist. Please advise
P.S : Am using c# in vs 2010
解决方案
You cannot use the method because DataRowCollection doesn't implement IEnumerable. You need to use the AsEnumerable() extension:
var dataRowQuery= myDataTable.AsEnumerable().Where(row => ...
You might also need a project reference to System.Data.DataSetExtensions for this to work.
Good luck!