Пример #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            Assessment_GV h = new Assessment_GV();

            this.Hide();
            h.Show();
        }
Пример #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "")
     {
         if (button3.Text == "Add Assessment")
         {
             SqlConnection conn = new SqlConnection("Data Source=DESKTOP-OQV6IBM;Initial Catalog=ProjectB;Integrated Security=True");
             conn.Open();
             string     Query = "insert into Assessment(Title,TotalMarks,TotalWeightage,DateCreated) values('" + this.textBox1.Text + "','" + this.textBox2.Text + "','" + this.textBox3.Text + "','" + DateTime.Now + "')";
             SqlCommand cmd   = new SqlCommand(Query, conn);
             cmd.ExecuteNonQuery();
             MessageBox.Show("Assessment Successfully Added");
         }
         else
         {
             SqlConnection conn = new SqlConnection("Data Source=DESKTOP-OQV6IBM;Initial Catalog=ProjectB;Integrated Security=True");
             conn.Open();
             string     Query = "update Assessment set Title='" + this.textBox1.Text + "',TotalMarks='" + this.textBox2.Text + "',TotalWeightage='" + this.textBox3.Text + "' where Id = '" + StdId + "'";
             SqlCommand cmd   = new SqlCommand(Query, conn);
             cmd.ExecuteNonQuery();
             MessageBox.Show("Assessment Updated Successfuly");
         }
         Assessment_GV f = new Assessment_GV();
         this.Hide();
         f.Show();
     }
     else
     {
         MessageBox.Show("Please fill all the fields ");
     }
 }