...不是外键列并且不能在此处使用?

发布于 2024-07-24 13:58:45 字数 262 浏览 1 评论 0原文

我在 SQL 中有两个视图,并在 Linq to SQL 中创建了到它们的映射。

这两个视图在 Ticket.ProblemCode 和 Problem.Code 之间有一个关联,该关联工作正常

当我尝试在 Ticket.ProblemCode 上设置 UIHint("ForeignKey") 并运行网页时,出现错误:

'ProblemCode' is not a外键列不能在此处使用。

有人知道为什么吗? 更重要的是,如何解决?

I have two views in SQL, and have created mappings to them in Linq to SQL.

The two views have an association, which works fine, between Ticket.ProblemCode and Problem.Code

When I try to set UIHint("ForeignKey") on Ticket.ProblemCode and run the web page I get the error:

'ProblemCode' is not a foreign key column and cannot be used here.

Anyone know why? More importantly, how to fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葬﹪忆之殇 2024-07-31 13:58:45

请参阅 ASP.NET 论坛上的这篇文章:
http://forums.asp.net/t/1254559.aspx

另外,您表示您在 Linq to SQL 中创建了关联。 数据库中是否存在实际的 PK/FK 约束,或者仅在您的 dbml 中表示?

See this post on the ASP.NET forums:
http://forums.asp.net/t/1254559.aspx

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文