Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();

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

            cmd1.Connection  = con;
            cmd2.Connection  = con;
            cmd1.CommandText = "DELETE FROM KetQua Where ID_SinhVien='" + txtmsv.Text + "'";
            cmd2.CommandText = "DELETE FROM SinhVien Where SinhVien_ID='" + txtmsv.Text + "'";
            DialogResult result;

            result = MessageBox.Show("BẠN CÓ MUỐN THAY XÓA THÔNG TIN KHÔNG?", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                cmd1.ExecuteNonQuery();
                cmd2.ExecuteNonQuery();
                MessageBox.Show("XÓA THÀNH CÔNG", "THÔNG BÁO");
            }
            con.Close();
            this.Close();
            frmDSSV frm = new frmDSSV(Lop_ID);

            frm.Show();
        }
Esempio n. 2
0
      private void button2_Click(object sender, EventArgs e)
      {
          this.Close();
          frmDSSV frm = new frmDSSV(Lop_ID);

          frm.Show();
      }
Esempio n. 3
0
        private void btnDS_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();

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

            cmd.Connection = con;
            string TenLop;

            TenLop          = cboDSLop.SelectedItem.ToString();
            cmd.CommandText = "SELECT Lop_ID FROM Lop WHERE TenLop='" + TenLop + "'";
            SqlDataReader rd;

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

            td.Load(rd);
            string MaLop;

            MaLop = td.Rows[0][0].ToString();
            con.Close();
            frmDSSV frmDS = new frmDSSV(MaLop);

            frmDS.Show();
            this.Close();
        }
Esempio n. 4
0
      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;
          int sex;

          if (radioButton1.Checked == true)
          {
              sex = 0;
          }
          else
          {
              sex = 1;
          }
          string TenLop = cbxLop.SelectedItem.ToString();

          cmd.CommandText = "select* from Lop where TenLop ='" + TenLop + "'";
          SqlDataReader rd;

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

          td.Load(rd);
          string MaLop = td.Rows[0][0].ToString();

          cmd.CommandText = "UPDATE SinhVien SET TenSinhVien='" + txttsv.Text + "',GioiTinh=" + sex + ",NgaySinh='" + mskns.Text + "',NoiSinh='" + txtnois.Text + "',NoiOHienTai='" + txttt.Text + "',KhoaHoc='" + txtkh.Text + "',LyLich='" + txtll.Text + "',ID_Lop='" + MaLop + "',HinhAnh='" + hinhanh + "'WHERE SinhVien_ID='" + txtmsv.Text + "'";
          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();
          this.Close();
          frmDSSV frm = new frmDSSV(Lop_ID);

          frm.Show();
      }