I query my data from database to display in my view. I used this query :
var ien_content = from c in this.DataContext.tbl_Contents
where c.ContentTypeID == id
&&
(
IsActive == false?true :(c.Active == null?true:c.Active > 0)
)
orderby c.RegisterDate descending
select c;
return ien_content.ToList();
There are many rows in this tbl_Contents, but when all of these rows are set Active = 0, it show the error : System.NullReferenceException: Object reference not set to an instance of an object.
Anyone can tell me, how to catch this error? Thanks.