private void AddButton_Click(object sender, EventArgs e) { if ( !(SkillNameBox.Text == "Skill Name") && !string.IsNullOrEmpty(SkillNameBox.Text) && !(ProficiencyBox.Text == "Proficiency") && !string.IsNullOrEmpty(ProficiencyBox.Text) && !(InterestBox.Text == "Interest") && !string.IsNullOrEmpty(InterestBox.Text) && !(YearsOfExperience.Text == "Years of Experience") && !string.IsNullOrEmpty(YearsOfExperience.Text) ) { SqlConnection con = new SqlConnection(@"Data Source=OLA\SQLSERVER;Initial Catalog=ApplicantTrackingSystem;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False"); con.Open(); string SkillInsertCommand = "INSERT INTO [Skill](Username,SkillName,Proficiency,Interest,ExperienceYears) VALUES (@Username,@SkillName,@Proficiency,@Interest,@ExperienceYears)"; SqlCommand SkillInsert = new SqlCommand(SkillInsertCommand, con); //@Username,@SkillName,@Proficiency,@Interest,@ExperienceYears SkillInsert.Parameters.AddWithValue("@Username", UserID); SkillInsert.Parameters.AddWithValue("@SkillName", SkillNameBox.Text); SkillInsert.Parameters.AddWithValue("@Proficiency", ProficiencyBox.Text); SkillInsert.Parameters.AddWithValue("@Interest", InterestBox.Text); SkillInsert.Parameters.AddWithValue("@ExperienceYears", YearsOfExperience.Text); SkillInsert.ExecuteNonQuery(); con.Close(); MessageBox.Show("Skill has been added successfully"); ViewSkillsPanel.Show(); AddSkillPanel.Hide(); } else { MessageBox.Show("Please Fill the Empty Boxes"); } }
private void ViewSkills_Click(object sender, EventArgs e) { ViewSkillsPanel.Show(); AddSkillPanel.Hide(); }