Ejemplo n.º 1
0
        public void KlassenLijstTonen()
        {
            string          _conn = string.Format("server=84.196.202.210;user id=Dylan;database=arduino;password={0}", "Devaien");
            MySqlConnection conn  = new MySqlConnection(_conn);

            conn.Open();
            string          _cmd = string.Format("SELECT idKlassen, KlasNaam from klassen");
            MySqlCommand    cmd  = new MySqlCommand(_cmd, conn);
            MySqlDataReader dr   = cmd.ExecuteReader();

            while (dr.Read())
            {
                Klassen objKlas = new Klassen(dr[1].ToString(), Convert.ToInt32(dr[0]));
                LitBox.Items.Add(objKlas);
            }

            conn.Close();
        }
Ejemplo n.º 2
0
        private void LitBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Klassen         objKlas = (Klassen)LitBox.SelectedItem;
            string          _conn   = string.Format("server=84.196.202.210;user id=Dylan;database=arduino;password={0}", "Devaien");
            MySqlConnection conn    = new MySqlConnection(_conn);

            conn.Open();
            string          _cmd = string.Format("SELECT idLeerlingen, LeerlingVNaam, LeerlingANaam FROM leerling WHERE klassen_idKlassen = {0} AND WHERE LeerlingKaatID = null", objKlas.intidKlassen);
            MySqlCommand    cmd  = new MySqlCommand(_cmd, conn);
            MySqlDataReader dr   = cmd.ExecuteReader();

            while (dr.Read())
            {
                Leerling objLeerling = new Leerling(dr[1].ToString(), (dr[0].ToString()));
                LitBox.Items.Add(objLeerling);
            }

            conn.Close();
        }