Can I have two databound cbo's to same parent Table/different rows

G

Guest

I'm trying to create an edit form to schedule two teams to play on a given
scheduled date. I have a Schedule Table and a TeamMatch Table. The TeamMatch
Table has a ScheduleID Column (FK) and two TeamID Columns (FK).

I'm in 2005 with a DataSet. I added the three TableAdapters and established
two relationships to the Teams Table from the Teams Table, one from each of
the FK.

I was hoping it would maintain state for each, but I guess it's not. When I
bring up the form, both comboboxes are showing the same Team row - the one
pointed to by the first FK. Do I need to make another TableAdapter for the
second parent Team?

ScheduleDateComboBox.DataSource = _Data.Schedules;
ScheduleDateComboBox.DisplayMember = "Description";
ScheduleDateComboBox.ValueMember = "ID";
ScheduleDateComboBox.DataBindings.Add("SelectedValue", _dv,
"ScheduleID");

Team1ComboBox.DataSource = _Data.Teams;
Team1ComboBox.DisplayMember = "Name";
Team1ComboBox.ValueMember = "TeamID";
Team1ComboBox.DataBindings.Add("SelectedValue", _dv,
"TeamID1");

Team2ComboBox.DataSource = _Data.Teams;
Team2ComboBox.DisplayMember = "Name";
Team2ComboBox.ValueMember = "TeamID";
Team2ComboBox.DataBindings.Add("SelectedValue", _dv,
"TeamID2");
 
E

Earl

Nope. Just create a separate dataview for each one, using the same table for
both dataviews. Otherwise they will march in lockstep as you've seen.
 

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