示例#1
0
        private void loadList()
        {
            if (comboBoxSupplier.SelectedValue != null)
            {
                int supID = Convert.ToInt32(comboBoxSupplier.SelectedValue);
                selectedSupplierID = supID;
                try
                {
                    // run the slq query method (included in ProductSupplier table)
                    list = ProductsDB.GetProducts(supID);

                    // run the toher sql query method (the not in)
                    notInList = ProductsDB.GetProdNotInList(supID);

                    // Display info
                    lstProducts.DataSource    = list;
                    lstProducts.DisplayMember = "ProdName";
                    lstProducts.ValueMember   = "ProductId";

                    listProducts.DataSource    = notInList;
                    listProducts.DisplayMember = "ProdName";
                    listProducts.ValueMember   = "ProductId";
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
            }
        }