private void button3_Click(object sender, EventArgs e) { try { Niveaus clt = NiveauDAO.Get_client_ID(int.Parse(tbID.Text)); tbnom.Text = clt.nom; tbngr.Text = clt.nbre_gr.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static Niveaus Get_client_ID(int id) { string requete = String.Format("select * from niveau;"); OleDbDataReader rd = utils.lire(requete); Niveaus c = new Niveaus(); while (rd.Read()) { c.id = rd.GetInt32(0); c.nom = rd.GetString(1); c.nbre_gr = rd.GetInt32(2); } utils.Disconnect(); return(c); }