...不是外键列,不能在此处使用? [英] ...is not a foreign key column and cannot be used here?
问题描述
我在SQL中有两个视图,并已在Linq to SQL中创建了到它们的映射.
I have two views in SQL, and have created mappings to them in Linq to SQL.
这两个视图在Ticket.ProblemCode和Problem.Code之间具有良好的关联性
The two views have an association, which works fine, between Ticket.ProblemCode and Problem.Code
当我尝试在Ticket.ProblemCode上设置UIHint("ForeignKey")并运行网页时,出现错误消息:
When I try to set UIHint("ForeignKey") on Ticket.ProblemCode and run the web page I get the error:
"ProblemCode"不是外键列,因此不能在此处使用.
'ProblemCode' is not a foreign key column and cannot be used here.
有人知道为什么吗?更重要的是,如何解决?
Anyone know why? More importantly, how to fix it?
推荐答案
请参阅ASP.NET论坛上的这篇文章: http://forums.asp.net/t/1254559.aspx
See this post on the ASP.NET forums: http://forums.asp.net/t/1254559.aspx
您还说过,您在Linq中创建了与SQL的关联.数据库中是否存在实际的PK/FK约束,还是仅在您的dbml中表示?
Also, you said that you created the association in Linq to SQL. Is there an actual PK/FK constraint in the database, or is it only represented in your dbml?
这篇关于...不是外键列,不能在此处使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!