public C_AchatVenteVoiture Lire_ID(int idOperation) { CreerCommande("SelectionnerAchatVenteVoiture_ID"); Commande.Parameters.AddWithValue("@idOperation", idOperation); Commande.Connection.Open(); SqlDataReader dr = Commande.ExecuteReader(); C_AchatVenteVoiture res = new C_AchatVenteVoiture(); while (dr.Read()) { res.idOperation = int.Parse(dr["idOperation"].ToString()); res.idVoiture = int.Parse(dr["idVoiture"].ToString()); res.idClient = int.Parse(dr["idClient"].ToString()); res.prixOperation = int.Parse(dr["prixOperation"].ToString()); res.dateOperation = DateTime.Parse(dr["dateOperation"].ToString()); res.idPaiement = int.Parse(dr["idPaiement"].ToString()); res.typeOperation = dr["typeOperation"].ToString(); } dr.Close(); Commande.Connection.Close(); return(res); }
public List <C_AchatVenteVoiture> Lire(string Index) { CreerCommande("SelectionnerAchatVenteVoiture"); Commande.Parameters.AddWithValue("@Index", Index); Commande.Connection.Open(); SqlDataReader dr = Commande.ExecuteReader(); List <C_AchatVenteVoiture> res = new List <C_AchatVenteVoiture>(); while (dr.Read()) { C_AchatVenteVoiture tmp = new C_AchatVenteVoiture(); tmp.idOperation = int.Parse(dr["idOperation"].ToString()); tmp.idVoiture = int.Parse(dr["idVoiture"].ToString()); tmp.idClient = int.Parse(dr["idClient"].ToString()); tmp.prixOperation = int.Parse(dr["prixOperation"].ToString()); tmp.dateOperation = DateTime.Parse(dr["dateOperation"].ToString()); tmp.idPaiement = int.Parse(dr["idPaiement"].ToString()); tmp.typeOperation = dr["typeOperation"].ToString(); res.Add(tmp); } dr.Close(); Commande.Connection.Close(); return(res); }