Beispiel #1
0
        private void comboBox4_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            comboBox3.Items.Clear();
            List <GetTeamItem> list3 = new List <GetTeamItem>();
            string             tid   = (comboBox4.SelectedItem as ComboboxItem).Value.ToString();

            con.Open();
            SqlCommand cmd = new SqlCommand("sel_chabid", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@t_id", tid);
            using (IDataReader dr = cmd.ExecuteReader())
            {
                while (dr.Read())
                {
                    GetTeamItem it = new GetTeamItem();
                    it.id          = dr[1].ToString();
                    it.displayName = dr[2].ToString();
                    list3.Add(it);
                }
            }
            con.Close();
            foreach (GetTeamItem gt in list3)
            {
                ComboboxItem it = new ComboboxItem();
                it.Text  = gt.displayName;
                it.Value = gt.id;
                comboBox3.Items.Add(it);
            }
        }
Beispiel #2
0
        public Sixpage()
        {
            InitializeComponent();
            con.Open();
            SqlCommand cmd = new SqlCommand("select_team", con);

            cmd.CommandType = CommandType.StoredProcedure;
            using (IDataReader dr = cmd.ExecuteReader())
            {
                while (dr.Read())
                {
                    GetTeamItem at = new GetTeamItem();
                    at.id          = dr[1].ToString();
                    at.displayName = dr[2].ToString();
                    list1.Add(at);
                }
            }
            con.Close();
            foreach (GetTeamItem gt in list1)
            {
                ComboboxItem it = new ComboboxItem();
                it.Text  = gt.displayName;
                it.Value = gt.id;
                comboBox1.Items.Add(it);
                comboBox4.Items.Add(it);
            }
        }