linq to sql checking for null -


my database field int_parentid consist of null value . how check null in linq query . not working

  return _db.categories.where(m => m.int_parentid==null); 

have mapped int_parentid database field int? type (e.g. <column name="int_parentid" type="system.int32" dbtype="int" canbenull="true" />)? if yes, both:

return _db.categories.where(m => m.int_parentid == null); 

and

return _db.categories.where(m => m.int_parentid.hasvalue); 

should work.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -