private void PreencherComboBoxID()
        {
            CursoBLL     curso = new CursoBLL();
            CrudCurso    crd   = new CrudCurso();
            MySqlCommand comando;

            try {
                crd.AbrirConexao();
                DataTable dt = new DataTable();
                comando = new MySqlCommand("SELECT curso.idcurso FROM curso ORDER BY idcurso", crd.conectarBD);
                MySqlDataReader dr = comando.ExecuteReader();
                dt.Load(dr);
                cmIdCurso.DisplayMember = "idcurso";
                cmIdCurso.DataSource    = dt;
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Beispiel #2
0
        private void PreencherComboBox()
        {
            CursoBLL     curso = new CursoBLL();
            CrudCurso    crd   = new CrudCurso();
            MySqlCommand comando;

            try {
                crd.AbrirConexao();
                DataTable dt = new DataTable();
                comando = new MySqlCommand("SELECT curso.nome_disciplina FROM curso ORDER BY nome_disciplina", crd.conectarBD);
                MySqlDataReader dr = comando.ExecuteReader();
                dt.Load(dr);
                cmbCursos.DisplayMember = "nome_disciplina";
                cmbCursos.DataSource    = dt;
            }
            catch (Exception ex) {
                MessageBox.Show("Erro: " + ex.Message);
            }
        }