作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个表Customer
,其外键约束为CustomerType(CustomerTypeId)
。
现在使用 EntityFramework,当我尝试在 Customer
表中插入记录时,出现错误消息
Cannot add or update a child row: a foreign key constraint fails ("Event"."Customer", CONSTRAINT "customer_ibfk_2" FOREIGN KEY ("CustomerTypeId") REFERENCES "CustomerType" ("CustomerTypeId"))
在研究此错误时,我发现在 MySQL 数据库中它区分大小写,因此我收到此错误。
是否有任何可能的解决方案来忽略 MYSQL 中的大小写敏感度?
最佳答案
一种解决方案是在任何地方使用lower函数。另一种解决方案更好,您必须修复数据库。更改您的外键或表,或者重新创建表。如果您有很多记录,则必须首先停用外键,然后根据需要更改值,然后再次激活外键。试试这个
关于MySQL - 区分大小写 : Cannot add or update a child row: a foreign key constraint fails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33705767/
我是一名优秀的程序员,十分优秀!