locked
update tabel field RRS feed

  • Question

  • User-1844117248 posted

    hi 

    i need to update one field in a tabel just to +2 and i can not find out how to do it 

    the code i have write until now is just to find the field i has to update 

    this i the code

     DataClassesDataContext db = new DataClassesDataContext();
                
    
                var query = from a in db.HoldTables
                            where a.Group == gt.Group &&
                            a.Teamname == gt.HoldA
                            select a.point;




    can somebody help me write the last code there can +2 to a.point field in my db


    Friday, December 24, 2010 8:11 PM

Answers

  • User2497035 posted

    1.            var query =( from a in db.HoldTables  
    2.                        where a.Group == gt.Group &&  
    3.                        a.Teamname == gt.HoldA  
    4.                        select a).FirstOrDefault(); 

                             query.point = query.point + 2;

                              db.SubmitChanges()

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 25, 2010 3:37 PM

All replies

  • User2497035 posted

    1.            var query =( from a in db.HoldTables  
    2.                        where a.Group == gt.Group &&  
    3.                        a.Teamname == gt.HoldA  
    4.                        select a).FirstOrDefault(); 

                             query.point = query.point + 2;

                              db.SubmitChanges()

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 25, 2010 3:37 PM
  • User-1844117248 posted

    thanks for you help 

    Saturday, December 25, 2010 4:12 PM