2011-04-13 107 views
3

我已經在Visual Studio中創建的關係在我的表2010數據庫項目,我收到此錯誤:錯誤SQL04111: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; 

我該如何解決?

回答

1

好的,我通過添加帳戶表中的其他列來解決問題。帳戶表有兩列主/複合鍵,在爭議表中,我只添加了兩個表中的一個。

相關問題