Bind combo box with data and display results

Discussion created by beckyzhuge on Apr 18, 2013
Dear all,

Currently, I am developing a simple application that contains 2 drop down lists, namely, products as well as price list.
The product drop down list has 4 options and how do I bind this drop down list with the values in the table so that I do not need to
pre-define the values. Additionally, this is also useful in the future because if there are new products, I can simply update the database
and the values will be automatically reflect in the drop down list.

I found a sample code that binds drop-down list with data from the database. Is this set of code suitable of for the web form in

ddlProduct.DataSource =  Product_Table
ddlProduct.DataSource.DataTextField = ???Product_Name???
ddlProduct.DataSource.DataValueField = ???Product_Name???

Second to retrive records from the database,  I have generated a sql statement:
Secondly, the first field is mandatory while the price list is optional. This means the user can perform 2 types of search.
??? Product
??? Product + Price List

This is the SQL statement that I have generated:

Select * from Product_Table where Product_Name = ???Printers??? OR ??? Scanners??? OR ???Laptops??? AND Price_List = ???100-200??? OR ???200-400??? OR ???400-600??? OR ???600-800??? OR ???800-1000??? OR ??????

How do i populate display results in data view because i tried to search for codes but cant find any