Skip to content
Loading
  • 0
    Sorry for not clearing at first point.. My problem is How can we Update fruigroupid of any row with a value that does not exist in the table, means it should be 10 or 20 but it could be any value other than 10 or 20. Keeping concurrency in our mind too.
    0
  • Jefferson S. Motta
    0
    Dear Shafique:
     
    This updates with any value:
     
    update #temp SET FroutGroupID = 30 where FruitiId = 1;
     
    I setup 30.
     
    Best, 
    0
  • 0
    Thanks for the update. We have to do it using unit of work, entity frame work. How can we acheive that?
    0
  • Jefferson S. Motta
    0
    like this?
     
    https://stackoverflow.com/questions/25894587/how-to-update-record-using-entity-framework-6 
     
    1. using (var db = new MyContextDB())  
    2. {  
    3.     var result = db.Books.SingleOrDefault(b => b.BookNumber == bookNumber);  
    4.     if (result != null)  
    5.     {  
    6.         result.SomeValue = "Some new value";  
    7.         db.SaveChanges();  
    8.     }  
    9. }  
     
    0
  • 0
    Yes
    0