i want to update multiple column value using Ef of one record but its does not give any error and there is no updating too
Hide Expand Copy Code
Code
Entities ef1 = new Entities();
Code
     int id1 = SafeConvert.ToInt16(ddlRollNo.SelectedValue);
Code
                var emp1 = (from em in ef1.ModifiedNames where em.Id == id select em).FirstOrDefault();
Code
                var Emp1 =(from em in ef1.Employees where em.Id == emp.BeltNo select em).FirstOrDefault();
Code
                   CTP.HRMS.WebApp.EF.Employee Emp = new EF.Employee();                    Emp.UserName = MyUser.UserName;
Code
               Emp.EntryDate = DateTime.Now;
Code
                 Emp.Id =Emp.Id ;
Code
                  Emp.CtrNo = txtCtrNo.Text;
Code
               Emp.Rank_Id = SafeConvert.ToByte(ddlRank.SelectedValue);
Code
                  Emp.Name = txtName.Text;
Code
                  Emp.Fathername = txtFatherName.Text;
Code
                Emp.Address = txtAddress.Text;
Code
                   Emp.Height = txtHeight.Text;
Code
                 Emp.Chest = txtChest.Text;
Code
                Emp.Caste = txtCaste.Text;
Code
               Emp.DistinguishMark = txtDistinguishMark.Text;
Code
                  Emp.Cnic = txtCnic.Text;
Code
                  Emp.SeniorityNo = SafeConvert.ToInt16(txtSeniorityNo.Text);
Code
                Emp.DateOfBirth = SafeConvert.ToDateTime(txtDateOfBirth.Text);
Code
                    Emp.DateOfEnrollment = SafeConvert.ToDateTime(txtDateOfEnrollment.Text);
Code
                   Emp.Education_Id = SafeConvert.ToByte(ddlEducation.SelectedValue);
Code
                Emp.Province_Id = SafeConvert.ToByte(ddlProvince.SelectedValue);
Code
               Emp.District_Id = SafeConvert.ToByte(ddlDistrict.SelectedValue);
Code
             Emp.EntryTestMarks = SafeConvert.ToDecimal(txtEntryTestMarks.Text);
Code
                 Emp.CourceTestMarks = SafeConvert.ToDecimal(txtCourceTestMarks.Text);
Code
                Emp.CellNo = txtCellNo.Text;
Code
                Emp.MartialStatus_Id = SafeConvert.ToByte(ddlMartialStatus.SelectedValue);
Code
                   Emp.OtherQualification = txtOtherQualification.Text;
Code
               Emp.IsEligibalForRouteDuty = txtIsEligibalForRouteDuty.Checked;
Code
              Emp.ImgBody = (Emp.ImgBody == null) ? new byte[0] : EmpImg.ImgBody;
Code
              //Image saving code                    Byte[] imgByte = null;
Code
                 if (txtEpPicture.HasFile && txtEpPicture.PostedFile != null)
Code
                 {
Code
                    //To create a PostedFile
Code
                    HttpPostedFile File = txtEpPicture.PostedFile;
Code
                    //Create byte Array with file len                        imgByte = new Byte[File.ContentLength];
Code
                     //force the control to load data in array                        File.InputStream.Read(imgByte, 0, File.ContentLength);
Code
                       Emp.ImgBody = imgByte;
Code
                 }                    ef1.Employees.Attach(ef1.Employees.Single(x => x.Id == Emp1.Id));
Code
                ef1.SaveChanges();
Code
              MsgLitteral.ShowNotificationInline("Employee Has Been Updated", true);
Code
how to update multiple field using EF?? PLZ