Esempio n. 1
0
        public image search()
        {
            string        q   = "select * from table_image where img_id=" + img_id;
            SqlCommand    cmd = new SqlCommand(q, connection.get());
            SqlDataReader sdr = cmd.ExecuteReader();
            image         i   = new image();

            while (sdr.Read())
            {
                i.img_id        = (int)sdr[0];
                i.img_path      = (string)sdr[1];
                i.img_fk_prd_id = (int)sdr[2];
            }
            sdr.Close();
            return(i);
        }
Esempio n. 2
0
        public List <image> showall()
        {
            string        q   = "select * from table_image";
            SqlCommand    cmd = new SqlCommand(q, connection.get());
            SqlDataReader sdr = cmd.ExecuteReader();
            List <image>  lst = new List <image>();

            while (sdr.Read())
            {
                image i = new image();
                i.img_id        = (int)sdr[0];
                i.img_path      = (string)sdr[1];
                i.img_fk_prd_id = (int)sdr[2];
                lst.Add(i);
            }
            sdr.Close();
            return(lst);
        }