【问题标题】:Error SQL04111: Visual studio 2010 database project错误 SQL04111:Visual Studio 2010 数据库项目
【发布时间】:2011-04-13 07:20:46
【问题描述】:

我在 Visual Studio 2010 数据库项目的表中创建了一个关系,但出现此错误:

Error SQL04111: The referenced table '[dbo].[tblAccount]' contains no primary or candidate keys that match the referencing column list in the foreign key. If the referenced column is a computed column, it should be persisted.

这是外键:

ALTER TABLE [dbo].[tblDispute]
    ADD CONSTRAINT [FK_AccountNo] 
    FOREIGN KEY (AccountNo)
    REFERENCES tblAccount ([Account No])  ON DELETE NO ACTION ON UPDATE CASCADE;

我该如何解决?

【问题讨论】:

    标签: sql visual-studio-2010 sql-server-2008 asp.net-mvc-3


    【解决方案1】:

    好的,我通过添加帐户表中的另一列解决了这个问题。帐户表有两列主键/复合键,在争议表中我只添加了两个表中的一个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-28
      • 2011-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-26
      • 2014-10-19
      • 2019-03-07
      相关资源
      最近更新 更多