...不是外键列,不能在此处使用? [英] ...is not a foreign key column and cannot be used here?

查看:72
本文介绍了...不是外键列,不能在此处使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆