Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Problems on SubmitChanges() in Linq?

Problems on SubmitChanges() in Linq?

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinqquestionannouncement
4 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    steven_wong
    wrote on last edited by
    #1

    Hello everyone: Now i am programing to update data with linq. i use dbcontext.submitchanges() to submit the changes to database.However, i find my table is not changed at all after that. Definately, there is no exception in the process of update, is there anyone know why? anything will be appreciated, thanX in advance~

    H 1 Reply Last reply
    0
    • S steven_wong

      Hello everyone: Now i am programing to update data with linq. i use dbcontext.submitchanges() to submit the changes to database.However, i find my table is not changed at all after that. Definately, there is no exception in the process of update, is there anyone know why? anything will be appreciated, thanX in advance~

      H Offline
      H Offline
      Howard Richards
      wrote on last edited by
      #2

      We need more info to help - ideally sample of the code that is failing.

      'Howard

      S 1 Reply Last reply
      0
      • H Howard Richards

        We need more info to help - ideally sample of the code that is failing.

        'Howard

        S Offline
        S Offline
        steven_wong
        wrote on last edited by
        #3

        here is the code: TestDataContext test= new TestDataContext(); var result= from person in test.Stuffs //Stuffs is a table where person.name==strUser; //strUser is a string passed in select person; foreach (var Item in result) { Item.value=777; } test.SubmitChanges();

        S 1 Reply Last reply
        0
        • S steven_wong

          here is the code: TestDataContext test= new TestDataContext(); var result= from person in test.Stuffs //Stuffs is a table where person.name==strUser; //strUser is a string passed in select person; foreach (var Item in result) { Item.value=777; } test.SubmitChanges();

          S Offline
          S Offline
          steven_wong
          wrote on last edited by
          #4

          Finally, i get the reason~ :laugh: I havnt set the primary key in my table,lol anyway, thank u all who have cared my msg~:rose:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups