linq to sql checking for null

前端 未结 4 722
别那么骄傲
别那么骄傲 2020-12-11 17:30

my database field int_ParentId consist of a Null value . how would i check it for a null in this linq query . it is not working

  return _db.Categories.Wher         


        
4条回答
  •  醉话见心
    2020-12-11 18:11

    I have this query working in this scenario

    YourContext db = new YourContext();
    List list =  (from n in db.YourEntity
                         where n.FieldToCheck.Equals(null)
                         select n).ToList();
    

    Hope it helps.

提交回复
热议问题