Error

  

Hi,

I am doing the bootkamp videos now, and am building the application in the dataqueries en widgetsII excercis. I finished step one and I am now able to add persons and role's, but when I add a new person  to a movie and click save I get an error mssge. 

2018-01-05 14:31:28The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_9J3_PERSONMOVIEROLE_OSUSR_9J3_MOVIE_MOVIEID". The conflict occurred in database "AB1F7X023", table "dbo.OSUSR_9J3_MOVIE", column 'ID'.
The statement has been terminated.


I cant seem to figure out what goes wrong. Can any of you help ?

Tnx !

Frank


Hi Frank,

Are you explicitly assigning the MovieId of PersonMovieRole as described in 3. e) of Part 1?

Hi,

I'm not really sure which lesson you are following but I can guess that you have a table that link persons to movies and when you are creating a record there you forgot to fill the movieId.

Regards,

Marcelo

Hello Frank,

This error means that you have a INSERT (Create or CreateOrUpdate) that you are doing, but you are not providing a mandatory Foreign Key.

In this case, you are trying to save/create a record in the PersonMovieRole, but you have to provide a valid MovieId, that you are not providing.

Than the error :)

I would say that or you are missing the combo box/drop down to select the movie, or you are binding it to a variable other than the Form record, but using the form record as source to the entity action. On either case, the source you are providing does not have this value defined on it.

Cheers,
Eduardo Jauch

Tnx for your reply's , they pointed me in the right direction. The problem was caused by an entity attribute (MovieId) that was set to mandatory "yes" (should have been "No") Fixed it and it works.