Ejemplo n.º 1
0
        public void UpdateSub(int id, Subscribers subscriber)
        {
            Conn.Open();
            SqlCommand Sqlcmm = new SqlCommand("UPDATE Subscribers set E_mail='" + subscriber.E_mail + "'  where Id='" + id + "' ", Conn);

            Sqlcmm.ExecuteNonQuery();
            Conn.Close();
        }
Ejemplo n.º 2
0
        public void Addsub(Subscribers subscriber)
        {
            Conn.Open();
            SqlCommand Scmm = new SqlCommand("insert into Subscribers (E_mail) values('" + subscriber.E_mail + "')", Conn);

            Scmm.ExecuteNonQuery();
            Conn.Close();
        }
Ejemplo n.º 3
0
        public Subscribers GetSubscriber(int id)
        {
            Subscribers subscrib = new Subscribers();

            Conn.Open();
            SqlCommand    Scmm = new SqlCommand("select * from Subscribers where Id='" + id + "' ", Conn);
            SqlDataReader dr   = Scmm.ExecuteReader();

            while (dr.Read())
            {
                subscrib.Id     = Convert.ToInt32(dr["Id"]);
                subscrib.E_mail = Convert.ToString(dr["E_mail"]);
            }
            Conn.Close();

            return(subscrib);
        }
Ejemplo n.º 4
0
        public List <Subscribers> AllSubscribers()
        {
            List <Subscribers> AllSub = new List <Subscribers>();

            Conn.Open();
            SqlCommand    Scmm = new SqlCommand("select * from Subscribers ", Conn);
            SqlDataReader dr   = Scmm.ExecuteReader();

            while (dr.Read())
            {
                Subscribers subscrib = new Subscribers();
                subscrib.Id     = Convert.ToInt32(dr["Id"]);
                subscrib.E_mail = Convert.ToString(dr["E_mail"]);



                AllSub.Add(subscrib);
            }
            Conn.Close();

            return(AllSub);
        }