How do you use LINQ (C#)
to select the value in a particular column for a particular row in a datatable
. The equivalent SQL
would be:
select NAME from TABLE where ID = 0
var name = from r in MyTable
where r.ID == 0
select r.Name;
If the row is unique then you could even just do:
var row = DataContext.MyTable.SingleOrDefault(r => r.ID == 0);
var name = row != null ? row.Name : String.Empty;