LINQ查询插入更新操作 [英] LINQ Query For Insert Update Operation

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

问题描述

我需要了解使用Linq中的Data上下文在一个函数中进行更新和插入查询是什么.请帮助我

I need to know what are the update and insert query in one single function using Data context in Linq..Please help me

推荐答案

请点击以下链接,

LINQ to SQL [ LINQ to SQL:所有常见操作(插入,更新,删除,获取) [ ^ ]
http://www.west-wind. com/weblog/posts/2008/Feb/05/Linq-to-SQL-DataContext-Lifetime-Management [ http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx [ 检查operationMode值,可以使用适当的调用进行插入和更新.

这将给您一个不错的主意,让您自己开始.

欢呼
Please follow the links below,

LINQ to SQL[^]
LINQ to SQL: All common operations (Insert, Update, Delete, Get) in one base class[^]
http://www.west-wind.com/weblog/posts/2008/Feb/05/Linq-to-SQL-DataContext-Lifetime-Management[^]
http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx[^]

For calling a single function, add one extra input parameter "operationMode" Add/Edit.
Checking the operationMode value, you can use the appropriate calling for insert and update.

This will give you fair idea to start on your own.

cheers


这篇关于LINQ查询插入更新操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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