Ejemplo n.º 1
0
        public C_Carburant Lire_ID(int idCarburant)
        {
            CreerCommande("SelectionnerCarburantVoiture_ID");
            Commande.Parameters.AddWithValue("@idCarburant", idCarburant);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            C_Carburant   res = new C_Carburant();

            while (dr.Read())
            {
                res.idCarburant  = int.Parse(dr["idCarburant"].ToString());
                res.nomCarburant = dr["nomCarburant"].ToString();
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Ejemplo n.º 2
0
        public List <C_Carburant> Lire(string Index)
        {
            CreerCommande("SelectionnerCarburantVoiture");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader      dr  = Commande.ExecuteReader();
            List <C_Carburant> res = new List <C_Carburant>();

            while (dr.Read())
            {
                C_Carburant tmp = new C_Carburant();
                tmp.idCarburant  = int.Parse(dr["idCarburant"].ToString());
                tmp.nomCarburant = dr["nomCarburant"].ToString();
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }