Beispiel #1
0
      private void button3_Click(object sender, EventArgs e)
      {
          string MaSV;
          string TenSV;

          MaSV  = txtmsv.Text;
          TenSV = txttsv.Text;
          frmsuakqSV frmsua = new frmsuakqSV(MaSV, TenSV);

          frmsua.Show();
      }
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = KetNoi.str;
            con.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection = con;
            string TenMonHoc = cbxMonHoc.SelectedItem.ToString();

            cmd.CommandText = "select * from MonHoc where TenMonHoc='" + TenMonHoc + "'";
            SqlDataReader rd;

            rd = cmd.ExecuteReader();
            DataTable td = new DataTable();

            td.Load(rd);
            string MaMonHoc = td.Rows[0][0].ToString();
            int    LanThi;

            LanThi = Convert.ToInt16(txtLanThi.Text);
            double DiemThi;

            DiemThi = Convert.ToDouble(txtDiemThi.Text);
            double TongKet;

            TongKet         = Convert.ToDouble(txtTongKet.Text);
            cmd.CommandText = "UPDATE KetQua SET LanThi=" + LanThi + ",DiemThi=" + DiemThi + ",DiemTongKet=" + TongKet + " WHERE ID_SinhVien='" + MaSV + "' AND ID_MonHoc='" + MaMonHoc + "'";
            DialogResult result;

            result = MessageBox.Show("BẠN CÓ MUỐN THAY ĐỔI THÔNG TIN KHÔNG?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("CẬP NHẬT THÀNH CÔNG", "THÔNG BÁO");
            }
            con.Close();
            Close();
            frmsuakqSV frmsua = new frmsuakqSV(MaSV, TenSV);

            frmsua.Show();
        }