コード例 #1
0
        public C_Frais Lire_ID(int idFrais)
        {
            CreerCommande("SelectionnerFraisVoiture_ID");
            Commande.Parameters.AddWithValue("@idFrais", idFrais);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            C_Frais       res = new C_Frais();

            while (dr.Read())
            {
                res.idFrais          = int.Parse(dr["idFrais"].ToString());
                res.idVoiture        = int.Parse(dr["idVoiture"].ToString());
                res.nomFrais         = dr["nomFrais"].ToString();
                res.descriptionFrais = dr["descriptionFrais"].ToString();
                res.coutFrais        = int.Parse(dr["coutFrais"].ToString());
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
コード例 #2
0
        public List <C_Frais> Lire(string Index)
        {
            CreerCommande("SelectionnerFraisVoiture");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader  dr  = Commande.ExecuteReader();
            List <C_Frais> res = new List <C_Frais>();

            while (dr.Read())
            {
                C_Frais tmp = new C_Frais();
                tmp.idFrais          = int.Parse(dr["idFrais"].ToString());
                tmp.idVoiture        = int.Parse(dr["idVoiture"].ToString());
                tmp.nomFrais         = dr["nomFrais"].ToString();
                tmp.descriptionFrais = dr["descriptionFrais"].ToString();
                tmp.coutFrais        = int.Parse(dr["coutFrais"].ToString());
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }