In both of the statement I am trying to fetch the ID of Catagory which has the name as specified in the variable;
both work fine. What is the difference and which one is better
string name = "Progreammers";
var categoryID = from c in DataContext.Categories
where c.Name == name
select c.CategoryID;
var categoryID = DataContext.Categories.Single(c => c.Name == name).CategoryID;
EDIT: There is only one Name(field) for every CategoryID(field) in the table