Exemplo n.º 1
0
        public CJoueurs Lire_ID(int joueurId)
        {
            CreerCommande("SelectionnerJoueurs_ID");
            Commande.Parameters.AddWithValue("@JoueurId", joueurId);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            CJoueurs      res = new CJoueurs();

            while (dr.Read())
            {
                res.JoueurId   = joueurId;
                res.License    = int.Parse(dr["License"].ToString());
                res.Nom        = dr["Nom"].ToString();
                res.Prenom     = dr["Prenom"].ToString();
                res.Classement = int.Parse(dr["Classement"].ToString());
                res.Mail       = dr["Mail"].ToString();
                res.Sexe       = int.Parse(dr["Sexe"].ToString());
                if (dr["Club"] != DBNull.Value)
                {
                    res.Club = int.Parse(dr["Club"].ToString());
                }
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Exemplo n.º 2
0
        public List <CJoueurs> Lire(string index)
        {
            CreerCommande("SelectionnerJoueurs");
            Commande.Parameters.AddWithValue("@Index", index);
            Commande.Connection.Open();
            SqlDataReader   dr  = Commande.ExecuteReader();
            List <CJoueurs> res = new List <CJoueurs>();

            while (dr.Read())
            {
                CJoueurs tmp = new CJoueurs
                {
                    JoueurId   = int.Parse(dr["JoueurId"].ToString()),
                    License    = int.Parse(dr["License"].ToString()),
                    Nom        = dr["Nom"].ToString(),
                    Prenom     = dr["Prenom"].ToString(),
                    Classement = int.Parse(dr["Classement"].ToString()),
                    Mail       = dr["Mail"].ToString(),
                    Sexe       = int.Parse(dr["Sexe"].ToString())
                };
                if (dr["Club"] != DBNull.Value)
                {
                    tmp.Club = int.Parse(dr["Club"].ToString());
                }
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }