I have a movie database where I'm trying to save a genre. I have the same project in winforms and there the code works, so it's probably something simple that I missed.
Anyways, here is the code:
MovieCollectionEntities db = new MovieCollectionEntities();
Genre g = new Genre();
g.GenreName = TextBoxGenresAdd.Text;
db.Genres.Add(g);
db.SaveChanges();
The error message I get is:
System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
edit:
Worth mentioning is probably that I'm using master paging and the code is from the AddGenre.aspx.
edit2: Complete answer can be found @ NullReferenceException in DbContext.saveChanges()