|
Subject:
|
How to fill a combobox with the items from a query
|
|
Posted By:
|
MacDevv
|
Post Date:
|
8/17/2006 8:03:00 AM
|
Hi there.
I am trying to create a search fucntion. For that i need to fill a combobox with te returnd values of a query. I created te following query on my dataset designer.
SELECT DISTINCT ACHTERNAAM FROM TELEFOONLIJST.
If i run this query in the query designer i get al de names in my database. when i insert the following code:
toolStripComboBox1.Items.Add(tELEFOONLIJSTTableAdapter.SelectAchternaam());
Only the fist value form the query result is placed in the combobox.
How do i get all the values from this query in my combobox. I canīt bind the combobox because it is an toolstripcombobox.
I hope someone can help me.
Greetz
MacDevv
|
|
Reply By:
|
bijgupt
|
Reply Date:
|
8/21/2006 7:59:23 AM
|
use datareader for fetching say dr
while(dr.Read()) { toolStripComboBox1.Items.Add(dr.GetValue(0));
}
Bijgupt
|