Entity Framework The ALTER TABLE statement conflicted with the FOREIGN KEY constraint

后端 未结 11 1835
傲寒
傲寒 2021-02-01 00:34

On updating database in Entity Framework , Code first Migration, I am getting this error:

The ALTER TABLE statement conflicted with the FOREIGN KEY constr

11条回答
  •  故里飘歌
    2021-02-01 01:24

    I got the solution of my Problem. Problem is "data" which i have in my clients table. Because my client table have medicalgroupid values which are not actually exist that's why it is giving me error on foreign key constraint.

    Update Client set MedicalGroupId = NULL
    

提交回复
热议问题