public void Update() { string strsql = "update JobPost set " + "RecruiterId= " + RecruiterId + ", " + "JobTitle= '" + JobTitle.Replace("'", "''") + "', " + "CompanyId= " + CompanyId + ", " + "DepartmentId= " + DepartmentId + ", " + "DesignationId= " + DesignationId + ", " + "JobType= '" + JobType.Replace("'", "''") + "', " + "ApplicableToSex= '" + ApplicableToSex.Replace("'", "''") + "', " + "MinSalary= " + MinSalary + ", " + "MaxSalary= " + MaxSalary + ", " + "JobDescription= '" + JobDescription.Replace("'", "''") + "', " + "Status= '" + Status.Replace("'", "''") + "' " + " where ID =" + Id; SqlConnection ObjConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyJobPortal"].ConnectionString); ObjConnection.Open(); SqlCommand ObjCommand = new SqlCommand(strsql, ObjConnection); ObjCommand.ExecuteNonQuery(); ObjConnection.Dispose(); ObjCommand.Dispose(); }