Esempio n. 1
0
        private void search_av_crops_Load(object sender, EventArgs e)
        {
            flowLayoutPanel1.Controls.Clear();
            con.Open();
            string        query = "select * from crop where id_farmer = '" + id_farmer + "'";
            SqlCommand    cmd   = new SqlCommand(query, con);
            SqlDataReader rdr   = cmd.ExecuteReader();

            while (rdr.Read())
            {
                av_crop av = new av_crop();
                av.farmer_id((int)rdr["id_farmer"]);
                av.crop_id((int)rdr["id_crop"]);
                av.crop_kind((string)rdr["kind"]);
                av.crop_quantity((int)rdr["quantity"]);
                av.crop_name((string)rdr["name"]);
                flowLayoutPanel1.Controls.Add(av);
            }
        }
Esempio n. 2
0
        public void load_crops()
        {
            con.Open();
            string     query = "av_crops";
            SqlCommand cmd   = new SqlCommand(query, con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader rdr = cmd.ExecuteReader();

            flowLayoutPanel1.Controls.Clear();
            while (rdr.Read())
            {
                av_crop av_crop = new av_crop();
                av_crop.farmer_id((int)rdr["id_farmer"]);
                av_crop.crop_id((int)rdr["id_crop"]);
                av_crop.crop_name((string)rdr["name"]);
                av_crop.crop_kind((string)rdr["kind"]);
                av_crop.crop_quantity((int)rdr["quantity"]);
                flowLayoutPanel1.Controls.Add(av_crop);
            }
            con.Close();
        }