TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
albert albert
NA
524
0
Null value
Jul 8 2014 6:55 AM
Hi everybody,
I have this:
[code]
if (medicijn.Volgorde == 999)
{
int medicijnHigest = medicijnService.GetAll().Where(i => i.Volgorde != 999).Max(m => m.Volgorde);
medicijn.Volgorde = medicijnHigest + 1;
medicijnService.Save(medicijn);
}
[/code]
but I get this error on medicijnHigest:
An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code
Additional information: The cast to value type 'System.Int32' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type.
Thank you
Reply
Answers (
2
)
Looking for 50% discount on Online .NET Training?
How to perform update and insert operation