public CSexes Lire_ID(int sexeId) { CreerCommande("SelectionnerSexes_ID"); Commande.Parameters.AddWithValue("@SexeId", sexeId); Commande.Connection.Open(); SqlDataReader dr = Commande.ExecuteReader(); CSexes res = new CSexes(); while (dr.Read()) { res.SexeId = sexeId; res.Denomination = dr["Denomination"].ToString(); } dr.Close(); Commande.Connection.Close(); return(res); }
public List <CSexes> Lire(string index) { CreerCommande("SelectionnerSexes"); Commande.Parameters.AddWithValue("@Index", index); Commande.Connection.Open(); SqlDataReader dr = Commande.ExecuteReader(); List <CSexes> res = new List <CSexes>(); while (dr.Read()) { CSexes tmp = new CSexes { SexeId = int.Parse(dr["SexeId"].ToString()), Denomination = dr["Denomination"].ToString() }; res.Add(tmp); } dr.Close(); Commande.Connection.Close(); return(res); }