当输入数据时抛出此异常解决方案plz .... [英] when enter data throw this exception solution plz....

查看:91
本文介绍了当输入数据时抛出此异常解决方案plz ....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

INSERT语句与FOREIGN KEY约束FK_Answers_Questions冲突。冲突发生在数据库TestSys,表dbo.Questions,列'ID'。

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Answers_Questions". The conflict occurred in database "TestSys", table "dbo.Questions", column 'ID'.

推荐答案

我们无法解决此问题。



它的含义是你想要输入一个与另一个表有关系的表的行:并且你提供的ID不存在于其他表。



尝试反过来创建条目:因此在编写Questions表数据之前,其他表中存在该ID值。
We can't fix this for you.

What it is saying is that you are tying to enter a row of a table that is in a relationship with a different table: and the ID you are providing does not exist in the other table.

Try creating your entries the other way round: so the that ID value exists in the other table before you write the Questions table data.


这意味着表 Questions 有一个列是 ForeignKey ,并且您要为该列插入一个值,实际上并不存在于 ForeignKey 表中。从命名,看起来像 ForeignKey 表是答案



这意味着您要插入问题表的答案 Id 不是有效的 Id ,因为它不存在于 Answers 表中。
That means the table "Questions" has a column which is a ForeignKey and you are inserting a value for that column, which is not actually present in the ForeignKey Table. From the naming, looks like the ForeignKey Table is "Answers".

That means the Answer Id you are inserting to the Questions Table is not a valid Id, because it is not existing in the Answers Table.


这篇关于当输入数据时抛出此异常解决方案plz ....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆