…is not a foreign key column and cannot be used here?

妖精的绣舞 提交于 2019-12-14 03:01:16

问题


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?


回答1:


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?



来源:https://stackoverflow.com/questions/1008641/is-not-a-foreign-key-column-and-cannot-be-used-here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!