Saturday, September 17, 2016

To update table using linq c#


  public bool update()
        {
            int res = 0;
            var query = dbcontext.taskdetails.Where(s => s.tid == 1).SingleOrDefault();
            query.name = "your updated data";
            query.amount = 500;
            res = dbcontext.SaveChanges();

            if (res > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

No comments:

Post a Comment

Git Commands

Git Version   To check the git version Git -v       Git Clone To clone the repository, use the following command: Git clone [u...