title: How to update data in Entity Framework?
body: <p>I have to update data in the data base. Data is shown in text boxes wen i select a data grid-view row. where am i wrong??</p>
  
  <pre><code>private void btnUpdate_Click(object sender, EventArgs e)
  {
      ent = new EmployeeEntities();
  
          EmployeeInfo emp = new EmployeeInfo();
          emp.EmpID = Convert.ToInt32(txtID.Text);
          emp.EmpName = txtName.Text;
          emp.EmpAddress = txtAddress.Text;
          emp.EmpDesignation = txtDesignation.Text;
          //ent.EmployeeInfoes.Add(emp);
          ent.SaveChanges();
          MessageBox.Show("Updated");
  
  }
  </code></pre>