Comboboxes loading datasource too many times

R

Richard

I have a form with tabpages on them. On one tabpage I have three
comboboxes all of which derive their datasource from the same table:-


TimePeriodID TimePeriod
1. Day(s)
2. Week(s)
3. Month(s)
4. Year(s)


When binding the fields for this form, I fill three sqldataadapters
with the data from this table.

I then set the datasource, valuemember, displaymember and databindings
properties of each combobox. Each combobox is of course bound to
different fields on the same tabpage.

What I find on running the form however, is that each combobox has
performed a "Union Query" on the datasource. That is the values of
the datasource have been loaded three times. So in the example above
I have TimePeriodID 1-4, followed by TimePeriodID 1-4, followed by
TimePeriodID 1-4.

Can anyone help me out of this little conundrum?



Richard
 
G

Guest

You are filling the same datatable three times.

Create separate datatables...one for each combobox.

Then set the datasource for each combobox to the separate datatable.
 
R

Richard

Aah! Thank you.



You are filling the same datatable three times.

Create separate datatables...one for each combobox.

Then set the datasource for each combobox to the separate datatable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top