linq runtime error with null value
Posted: Wed 03 Feb 2010 15:08
I use several queries in my application that I check to make sure that a row in the database is not marked as deleted.
var MessageBoardData = (from m in db.MessageBoards
where ((m.IsDeleted == null) || (m.IsDeleted == false))
select m);
With this linq query Im getting a runtime error.
"Unable to cast object of type 'Devart.Data.Linq.Provider.Query.m' to type 'Devart.Data.Linq.Provider.Query.ap'."
If I take out "(m.IsDeleted == null)" from the query, it will work fine. Is there a way to have a query where I can check against a null value.
Thanks for the help.
var MessageBoardData = (from m in db.MessageBoards
where ((m.IsDeleted == null) || (m.IsDeleted == false))
select m);
With this linq query Im getting a runtime error.
"Unable to cast object of type 'Devart.Data.Linq.Provider.Query.m' to type 'Devart.Data.Linq.Provider.Query.ap'."
If I take out "(m.IsDeleted == null)" from the query, it will work fine. Is there a way to have a query where I can check against a null value.
Thanks for the help.