<bdo id='wnwVw'></bdo><ul id='wnwVw'></ul>
  • <small id='wnwVw'></small><noframes id='wnwVw'>

    <legend id='wnwVw'><style id='wnwVw'><dir id='wnwVw'><q id='wnwVw'></q></dir></style></legend>
    <i id='wnwVw'><tr id='wnwVw'><dt id='wnwVw'><q id='wnwVw'><span id='wnwVw'><b id='wnwVw'><form id='wnwVw'><ins id='wnwVw'></ins><ul id='wnwVw'></ul><sub id='wnwVw'></sub></form><legend id='wnwVw'></legend><bdo id='wnwVw'><pre id='wnwVw'><center id='wnwVw'></center></pre></bdo></b><th id='wnwVw'></th></span></q></dt></tr></i><div id='wnwVw'><tfoot id='wnwVw'></tfoot><dl id='wnwVw'><fieldset id='wnwVw'></fieldset></dl></div>

    1. <tfoot id='wnwVw'></tfoot>
      1. INSERT 语句与 FOREIGN KEY 约束冲突

        The INSERT statement conflicted with the FOREIGN KEY constraint(INSERT 语句与 FOREIGN KEY 约束冲突)
            <tbody id='wrhfk'></tbody>

        • <i id='wrhfk'><tr id='wrhfk'><dt id='wrhfk'><q id='wrhfk'><span id='wrhfk'><b id='wrhfk'><form id='wrhfk'><ins id='wrhfk'></ins><ul id='wrhfk'></ul><sub id='wrhfk'></sub></form><legend id='wrhfk'></legend><bdo id='wrhfk'><pre id='wrhfk'><center id='wrhfk'></center></pre></bdo></b><th id='wrhfk'></th></span></q></dt></tr></i><div id='wrhfk'><tfoot id='wrhfk'></tfoot><dl id='wrhfk'><fieldset id='wrhfk'></fieldset></dl></div>

          <tfoot id='wrhfk'></tfoot>
            1. <small id='wrhfk'></small><noframes id='wrhfk'>

                  <bdo id='wrhfk'></bdo><ul id='wrhfk'></ul>

                • <legend id='wrhfk'><style id='wrhfk'><dir id='wrhfk'><q id='wrhfk'></q></dir></style></legend>
                  本文介绍了INSERT 语句与 FOREIGN KEY 约束冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  错误:System.Data.SqlClient.SqlException:INSERT 语句与 FOREIGN KEY 约束FK__Item__order__3AE27131"冲突.冲突发生在数据库pmall"、表dbo.ItemSaved"、列id"中.

                  Error: System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Item__order__3AE27131". The conflict occurred in database "pmall", table "dbo.ItemSaved", column 'id'.

                  这是我的桌子:

                  • id
                  • ItemID(在此表中设置为 Item.id 的 FK)
                  • ...等

                  这是我的插入语句:

                  insert into ItemSavedUnits (ItemID, name, Price)
                  select ItemID, name,Price
                  from ItemUnits where ItemID = 92439 
                  

                  我真的不明白为什么如果我对与 Item.ItemID 和 ItemUnits 相关的 ItemSavedUnits.ItemID 的 FK 约束根本没有约束,为什么我在插入 ItemSavedUnits 时遇到问题.我尝试插入的 ItemID 确实存在于 Item 表中.

                  I don't really understand why if I a FK constraint on ItemSavedUnits.ItemID that is related to Item.ItemID and ItemUnits has no constraints at all why I'm getting a problem inserting into ItemSavedUnits. The ItemID I'm tryign to insert does exist in the Item table.

                  推荐答案

                  您确定 ItemId 92439 存在于 Item 表中,而不仅仅是 ItemUnits 中吗?

                  Are you absolutely sure that ItemId 92439 exists in the Item table, and not just in ItemUnits?

                  您的 select 语句是否返回 null?

                  Is your select statement returning null?

                  这篇关于INSERT 语句与 FOREIGN KEY 约束冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  How can I import an Excel file into SQL Server?(如何将 Excel 文件导入 SQL Server?)
                  Export table to file with column headers (column names) using the bcp utility and SQL Server 2008(使用 bcp 实用程序和 SQL Server 2008 将表导出到带有列标题(列名称)的文件)
                  Concat field value to string in SQL Server(将字段值连接到 SQL Server 中的字符串)
                  SQL Server Bulk insert of CSV file with inconsistent quotes(SQL Server 批量插入带有不一致引号的 CSV 文件)
                    <tbody id='WdJbU'></tbody>
                  • <bdo id='WdJbU'></bdo><ul id='WdJbU'></ul>

                  • <legend id='WdJbU'><style id='WdJbU'><dir id='WdJbU'><q id='WdJbU'></q></dir></style></legend>

                    • <i id='WdJbU'><tr id='WdJbU'><dt id='WdJbU'><q id='WdJbU'><span id='WdJbU'><b id='WdJbU'><form id='WdJbU'><ins id='WdJbU'></ins><ul id='WdJbU'></ul><sub id='WdJbU'></sub></form><legend id='WdJbU'></legend><bdo id='WdJbU'><pre id='WdJbU'><center id='WdJbU'></center></pre></bdo></b><th id='WdJbU'></th></span></q></dt></tr></i><div id='WdJbU'><tfoot id='WdJbU'></tfoot><dl id='WdJbU'><fieldset id='WdJbU'></fieldset></dl></div>

                          <small id='WdJbU'></small><noframes id='WdJbU'>

                            <tfoot id='WdJbU'></tfoot>