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