示例#1
0
        private void comboBox1_Click(object sender, EventArgs e)
        {
            comboBox1.Items.Clear();
            string        Query_ = "SELECT PFamily, PFullModelName FROM CPU";
            SqlDataReader dr     = NewConnection.DataReader(Query_);

            dr.Read();
            try
            {
                while (dr.Read())
                {
                    comboBox1.Items.Add((string)dr["PFullModelName"]);
                }
            }
            finally
            {
                dr.Close();
            }
        }
示例#2
0
        public void comboBox2_Click(object sender, EventArgs e)
        {
            comboBox2.Items.Clear();
            NewConnection.OpenConection();
            string        Query_ = "SELECT distinct PFamily FROM CPU";
            SqlDataReader dr     = NewConnection.DataReader(Query_);

            dr.Read();
            try
            {
                while (dr.Read())
                {
                    comboBox2.Items.Add((string)dr["PFamily"]);
                }
            }
            finally
            {
                // Always call Close when done reading.
                dr.Close();
            }


            if (comboBox1.Text == "Intel")
            {
                comboBox1.Items.Clear();
                comboBox2.Items.Clear();
                string        Query1 = "SELECT distinct PFamily FROM CPU WHERE (Producent = 'Intel')";
                SqlDataReader dr1    = NewConnection.DataReader(Query1);
                dr1.Read();
                try
                {
                    while (dr1.Read())
                    {
                        comboBox2.Items.Add((string)dr1["PFamily"]);
                    }
                }
                finally
                {
                    // Always call Close when done reading.
                    dr1.Close();
                }
            }
            else if (comboBox1.Text == "AMD")
            {
                comboBox1.Items.Clear();
                comboBox2.Items.Clear();
                string        Query2 = "SELECT distinct PFamily FROM CPU WHERE (Producent = 'AMD')";
                SqlDataReader dr2    = NewConnection.DataReader(Query2);
                dr2.Read();
                try
                {
                    while (dr2.Read())
                    {
                        comboBox2.Items.Add((string)dr2["PFamily"]);
                    }
                }
                finally
                {
                    // Always call Close when done reading.
                    dr2.Close();
                }
            }
        }