public C_T_Section Lire_ID(int Id_Section) { CreerCommande("SelectionnerT_Section_ID"); Commande.Parameters.AddWithValue("@Id_Section", Id_Section); Commande.Connection.Open(); SqlDataReader dr = Commande.ExecuteReader(); C_T_Section res = new C_T_Section(); while (dr.Read()) { res.Id_Section = int.Parse(dr["Id_Section"].ToString()); res.S_Nom = dr["S_Nom"].ToString(); if (dr["S_Age_Min"] != DBNull.Value) { res.S_Age_Min = int.Parse(dr["S_Age_Min"].ToString()); } if (dr["S_Age_Max"] != DBNull.Value) { res.S_Age_Max = int.Parse(dr["S_Age_Max"].ToString()); } res.S_Sexe = dr["S_Sexe"].ToString(); res.S_Complet = bool.Parse(dr["S_Complet"].ToString()); } dr.Close(); Commande.Connection.Close(); return(res); }
public List <C_T_Section> Lire(string Index) { CreerCommande("SelectionnerT_Section"); Commande.Parameters.AddWithValue("@Index", Index); Commande.Connection.Open(); SqlDataReader dr = Commande.ExecuteReader(); List <C_T_Section> res = new List <C_T_Section>(); while (dr.Read()) { C_T_Section tmp = new C_T_Section(); tmp.Id_Section = int.Parse(dr["Id_Section"].ToString()); tmp.S_Nom = dr["S_Nom"].ToString(); if (dr["S_Age_Min"] != DBNull.Value) { tmp.S_Age_Min = int.Parse(dr["S_Age_Min"].ToString()); } if (dr["S_Age_Max"] != DBNull.Value) { tmp.S_Age_Max = int.Parse(dr["S_Age_Max"].ToString()); } tmp.S_Sexe = dr["S_Sexe"].ToString(); tmp.S_Complet = bool.Parse(dr["S_Complet"].ToString()); res.Add(tmp); } dr.Close(); Commande.Connection.Close(); return(res); }