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
Post a Comment