Cannot add or update a child row 数据库错误

Posted 逐风一缕

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cannot add or update a child row 数据库错误相关的知识,希望对你有一定的参考价值。

 异常处理:

错误代码:1452

Cannot add or update a child row: a foreign key constraint fails (`1go`.`#sql-16ec_1f`, CONSTRAINT `fk_999` FOREIGN KEY (`goods_id`) REFERENCES `goods` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)

错误原因:数据库中存在着外键约束,可能在实体类中某一个属性添加时,没有外键主体的属性值,看下自己的代码,有没有设置值错误的

 

以上是关于Cannot add or update a child row 数据库错误的主要内容,如果未能解决你的问题,请参考以下文章

Django报错修复:1452, ‘Cannot add or update a child row: a foreign key constraint fails

hibernate错误:Cannot add or update a child row: a foreign key constraint fails

insert时报Cannot add or update a child row: a foreign key constraint fails (`yanchangzichan`.`products

ERROR 1452 : Cannot add or update a child row: a foreign key constraint fails

Django报错修复:1452, ‘Cannot add or update a child row: a foreign key constraint fails

Django报错修复:1452, ‘Cannot add or update a child row: a foreign key constraint fails