By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,385 Members | 1,119 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,385 IT Pros & Developers. It's quick & easy.

Comboboxes loading datasource too many times

P: n/a
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



Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
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.

"Richard" wrote:
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



Nov 21 '05 #2

P: n/a
Aah! Thank you.

On Mon, 1 Aug 2005 08:46:18 -0700, "Charlie" <cfarrier at
charlesfarriersoftware.com> wrote:
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.

"Richard" wrote:
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




Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.