private void button5_Click(object sender, EventArgs e) { RubricsGV h = new RubricsGV(); this.Hide(); h.Show(); }
private void button1_Click(object sender, EventArgs e) { if (richTextBox1.Text != "" && comboBox1.Text != "") { string CloId = (comboBox1.SelectedItem as ComboboxItem).Value.ToString(); if (button1.Text == "Add Rubrics") { SqlConnection conn = new SqlConnection("Data Source=DESKTOP-OQV6IBM;Initial Catalog=ProjectB;Integrated Security=True"); conn.Open(); string Query = "insert into Rubric(Details,CloId) values('" + this.richTextBox1.Text + "','" + CloId + "')"; SqlCommand cmd = new SqlCommand(Query, conn); cmd.ExecuteNonQuery(); MessageBox.Show("Rubrics Successfully Added"); } else { SqlConnection conn = new SqlConnection("Data Source=DESKTOP-OQV6IBM;Initial Catalog=ProjectB;Integrated Security=True"); conn.Open(); string Query = "update Rubric set Details='" + this.richTextBox1.Text + "',CloId='" + CloId + "' where Id = '" + StdId + "'"; SqlCommand cmd = new SqlCommand(Query, conn); cmd.ExecuteNonQuery(); MessageBox.Show("Rubrics Updated Successfuly"); } RubricsGV h = new RubricsGV(); this.Hide(); h.Show(); } else { MessageBox.Show("Please fill all the required fields"); } }