public static vente Get_vent_ID(int id) { string requete = String.Format("select * from vente where id={0};", id); OleDbDataReader rd = utils.lire(requete); vente v = new vente(); while (rd.Read()) { v.Id = rd.GetInt32(0); v.Produit = rd.GetString(1); v.Quantite = rd.GetInt32(2); v.montant_tot = rd.GetInt32(3); v.date_v = rd.GetDateTime(4); } utils.Disconnect(); return(v); }
private void button3_Click(object sender, EventArgs e) { try { vente v = venteDAO.Get_vent_ID(int.Parse(tbID.Text)); tbprod.Text = v.Produit; tbqt.Text = (v.Quantite).ToString(); tbmont.Text = (v.montant_tot).ToString(); textdate.Text = (v.date_v).ToString(); List <vente> L = new List <vente>(); L.Add(v); grid_vent.DataSource = L; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static List <vente> Get_vent_client(int id) { string requete = String.Format("select * from vente where id_client={0};", id); OleDbDataReader rd = utils.lire(requete); List <vente> L = new List <vente>(); vente v; while (rd.Read()) { v = new vente { Id = rd.GetInt32(0), Produit = rd.GetString(1), Quantite = rd.GetInt32(2), montant_tot = rd.GetInt32(3), date_v = rd.GetDateTime(4) }; L.Add(v); } utils.Disconnect(); return(L); }