The INSERT statement conflicted with the FOREIGN KEY constraint

Hi The OutSystems Team

I'm doing the Web clinic app  .

At the moment that I'm creating patient new account  and after enter the information and click  save button, the following error occurs:

The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_K2R_SPACEUSER_OSUSR_K2R_CATEGORY_CATEGORY".The conflict occurred in database "GBS5XH032", table "dbo.OSUSR_K2R_CATEGORY", column 'ID'. The statement has been terminated.

Could anyone help me solve this problem please?

Regards

Abdulaziz

Hi Abdulaziz ,

Its a database exception and it means you are inserting bad data in the table that has foreign key constraint.

For example you have a Category Table and you have CategoryId as a foreign Key in other table may be SPACEUSER . Now you are trying to insert Category ID data other then the IDs that you have in CategoryID  raising an exception. 

So kindly check the assignments.

Hope this would help.

Best Regards

Devendra

Hey,

There are 2 possibilities 

1.the value in categoryid is not exist in category table

2.may be it passing null value where as category I'd column in entity has mandatory field.

Please check what value you are passing ro it.

Thanks

Yogesh

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.