udpate外键 [英] udpate foreign key

查看:88
本文介绍了udpate外键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

如果该字段是与另一个表相关的fk ID,如何使用L2E更新表中的字段。看来我不能简单地插入一个我知道与该外表中的值相关的整数值。防爆。 - 我有一张员工表和一份职称表。 employee表的jobID是一个与作业标题表中的jobID字段相关的整数。当我在Employee表中插入新记录时,我无法简单地设置Employee.jobID = 1的值。

how do I update a field in a table using L2E if that field is a fk ID that relates to another table.  It seems I cannot simply insert an integer value that I know relates to a value in that foreign table.  Ex.  - I have an employee table and a job title table.  the employee table has a jobID that is an integer that relates to the jobID field in the job title table.  When I insert a new record into the Employee table, I am not able to simply set the value of Employee.jobID = 1.

谢谢任何想法。

推荐答案

嗨卡尔,

我刚刚解决了我的问题:),你可以查看:

I just solved mine :), You can check this:

http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/20f775b6-6e84-4021-8e29-5e02f724c6f0/?ffpr=0


这篇关于udpate外键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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