Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(conn);

            SqlCommand exe = new SqlCommand("Update Assessment  set Title='" + txtTitle.Text.ToString() + "',DateCreated='" + dtCreatedAssessment.Value.Date + "',TotalMarks='" + txtTotalMarks.Text.ToString() + "',TotalWeightage='" + txtTotalWeightage.Text.ToString() + "' where id ='" + ID + "'", connection);

            connection.Open();
            exe.CommandType = CommandType.Text;
            exe.ExecuteNonQuery();
            MessageBox.Show("UPdated Successfully!!");

            Form19 frm6 = new Form19();

            this.Hide();
            frm6.Show();
        }
Beispiel #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(conn);

            con.Open();

            int id = int.Parse(dgAssessmentDetail.Rows[row].Cells[0].Value.ToString());

            SqlCommand command = new SqlCommand("delete from Assessment where Id = '" + id + "'", con);

            command.ExecuteNonQuery();
            MessageBox.Show("Deleted sucesfully!");
            Form19 frm = new Form19();

            this.Hide();

            frm.Show();
        }