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

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -