/* Hàm load dữ liệu khoa lên CBB */
        void GetCBB()
        {
            string query = "SELECT * FROM KHOA";

            DB.conn.Open();
            SqlCommand    cmd = new SqlCommand(query, DB.conn);
            SqlDataReader rd  = cmd.ExecuteReader();

            KhoaDic = new Dictionary <string, CKhoa>();
            while (rd.Read())
            {
                CKhoa gt2 = new CKhoa(rd[0].ToString(), rd[1].ToString());
                cbbKhoa.Items.Add(gt2);
                KhoaDic[gt2.Ma_khoa] = gt2;
            }
            DB.conn.Close();
        }
Пример #2
0
        //Lấy dữ liệu cho combobox ngành
        void Get_nganh()
        {
            cbbKhoa.DisplayMember = "Ten_khoa";
            cbbKhoa.ValueMember   = "Ma_khoa";
            string query = "SELECT * FROM KHOA";

            DB.conn.Open();
            SqlCommand    cmd = new SqlCommand(query, DB.conn);
            SqlDataReader rd  = cmd.ExecuteReader();

            KhoaDic = new Dictionary <string, CKhoa>();
            while (rd.Read())
            {
                CKhoa gt1 = new CKhoa(rd[0].ToString(), rd[1].ToString());
                cbbNganh.Items.Add(gt1.Ten_khoa);
                KhoaDic[gt1.Ma_khoa] = gt1;
            }
            DB.conn.Close();
        }