Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
I need to know what are the update and insert query in one single function using Data context in Linq..Please help me
Posted 1-Oct-12 18:01pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 950
1 OriginalGriff 508
2 Abhinav S 233
3 thatraja 225
4 Emre Ataseven 200
0 Sergey Alexandrovich Kryukov 8,142
1 OriginalGriff 4,665
2 Peter Leow 3,774
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid