在Linq中向SQL插入查询 [英] insert query in Linq to sql

查看:86
本文介绍了在Linq中向SQL插入查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

遇到问题时,我正在使用插入查询,我想插入外键,例如:

我想在工作表中插入工作人员ID,在工作表中,工作人员表中的雇员名称为"XYZ",

我试图从雇员表中选择名称为"XYZ"的ID,然后将其插入到工作表中.

这是正确的方法还是我还能做什么?

提前谢谢.
:)

Hi all,

I was using the insert query when I faced a problem , I want to insert the foreign key , for example :

I want to insert the employee''s ID in the job table where the employee''s name is "XYZ" in the employees table,

I tried to select from the employees table the ID where the name is "XYZ" then insert it in the job table.

Is this a right way or what can I do else?

Thanks in advance.
:)

推荐答案

据我所知,这种方法很好.
As far as I know, this way is fine.


这篇关于在Linq中向SQL插入查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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