Updating records using linq

I would probably pass in the customer log as a parameter to the method and then have it deal with just the database insertion.

If you wanted to keep a Insert Or Update type of approach I would branch on perhaps something like the object ID if it has one.

A couple of problems I see in your approach: // a method higher up the chain void Create Customer Log() void Update Customer Log(string application No) Data_Customer_Log Get Customer Log(string application No) Data_Customer_Log Insert Or Update(Data_Customer_Log record) Data_Customer_Log Insert(Data_Customer_Log record) Data_Customer_Log Update(Data_Customer_Log record) I would probably point out that these methods would probably be in different classes.

When we defined our data model, the LINQ to SQL designer also created a custom Data Context class that provides the main conduit by which we'll query our database and apply updates/changes.

In the example data model we defined above this class was named "Northwind Data Context".

Hi all, I am new to Linq and want to update data in a table. I create datacontext also and values assign to it as well and in the last dc.

Submit Changes(); also code but updation does not perform.

updating records using linq-12updating records using linq-86updating records using linq-38

You can accomplish this by adding/removing data objects from the Data Context's table collections, and by then calling the Submit Changes() method.

Join our conversation (29 Comments).
Click Here To Leave Your Comment Updating records using linq.


  1. 1

    Why not see the Saint-Petersburg, the finest pearl of Russia, from a unique perspective and have your sweethearts living outside Russia joined you for a creative, romantic and unique tour.

  2. 1

    According to Phillip Hodson, of the British Association of Counselling and Psychotherapy, the reason for the surge in people signing up to dating websites is down to singletons taking stock of their lot at the end of another year.

  3. 1

    It's no secret that many people dislike live video calls.

  4. 1

    Entrée journée 10 Entrée journée samedi soirée dansante 18 1 boisson Entrée soirée dansante 10 1 boisson Contact.

  5. 1

    Our team is now working just a few miles down the road with the Google team, where we continue to focus on creating delightful experiences for our users, developers, and publishers.

  6. 1

    Like many women, she has an uneven skin tone which looks particularly raw around the mouth - but with make-up she look sensational'A lot of people look at porn stars and assume they are in a constant state of eyeliner and push-up bra, that they were born that way as the "lucky women" and that they couldn't possibly look like - or be - someone's sister or mom,' one woman named Annie wrote on the community web blog Meta Filter.'Also, a lot of guys seem to go around thinking there's this big difference between "average" women and the Super Hot, which in a lot of cases is more about dedication than genes (makeup, clothing, breast enhancements).

Leave a Reply

Your email address will not be published. Required fields are marked *