I have defined a dataset using the DataSource Configuration Wizard. I
dropped 3 tables onto the design surface. It looks like this:

Tbl1 Tbl2 Tbl3
PK
FK========> PK
FK=========>PK

Table 1 is a Client, tbl2 is a Person and 3 is an Address.
There is only one Person for a Client and only one Address for a
Person.

When I look at the relations the designer created, it says that for
the Client-Person relation, the Person is the parent and the child is
the Client. The relation editor will not allow me to change this.

I created a bindingsource for the client. I set its datasource
property to the dataset and table Client to the DataMember property. I
created another bindingsource, PersonBindingSource, and set is
datasource to the dataset and the Person table to the DataMember
property. Finally I created an Address bindingsource and set its
datasource to the dataset and its Address table to the DataMember
property.

I used a bindingnavigator. When I move from row to row with the
navigator, only those controls bound to the client binding source
reflect the navigation. The controls bound to either the Person or
Address do not.

I must be missing something basic. Can someone please help?

Thanks

Re: BindingSource, DataSet and multiple tables not syncing by RobinS

RobinS
Sun Jan 28 23:11:16 CST 2007

For the children, you need to bind them to the data relation with the
parent table instead of the child table. Then when you move through the
records of the parent, the children will change as well.

Here's an example that runs against Northwind using the
Customers and Orders tables.

* Dim ds as CustomersDataSet = CustomersDataSet.GetCustomers()
*
* m_CustomersBindingSource.DataSource = ds
* m_CustomersBindingSource.DataMember = "Customers"
* m_CustomersGrid.DataSource = m_CustomersBindingSource
*
* m_ChildOrdersBindingSource.DataSource = m_CustomersBindingSource
* m_ChildOrdersBindingSource.DataMember = "FK_Orders_Customers"
*
* m_OrdersGrid.DataSource = m_ChildOrdersBindingSource

Robin S.
----------------------------------------------
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:efcqr2hq32mk1j9e9tq4rndn3n344e06qd@4ax.com...
>I have defined a dataset using the DataSource Configuration Wizard. I
> dropped 3 tables onto the design surface. It looks like this:
>
> Tbl1 Tbl2 Tbl3
> PK
> FK========> PK
> FK=========>PK
>
> Table 1 is a Client, tbl2 is a Person and 3 is an Address.
> There is only one Person for a Client and only one Address for a
> Person.
>
> When I look at the relations the designer created, it says that for
> the Client-Person relation, the Person is the parent and the child is
> the Client. The relation editor will not allow me to change this.
>
> I created a bindingsource for the client. I set its datasource
> property to the dataset and table Client to the DataMember property. I
> created another bindingsource, PersonBindingSource, and set is
> datasource to the dataset and the Person table to the DataMember
> property. Finally I created an Address bindingsource and set its
> datasource to the dataset and its Address table to the DataMember
> property.
>
> I used a bindingnavigator. When I move from row to row with the
> navigator, only those controls bound to the client binding source
> reflect the navigation. The controls bound to either the Person or
> Address do not.
>
> I must be missing something basic. Can someone please help?
>
> Thanks



Re: BindingSource, DataSet and multiple tables not syncing by Flomo

Flomo
Sun Jan 28 23:37:14 CST 2007

Thanks for the response Robin.

I set all the binding properties in the Property window. When I select
the child bindingsource and set its datasource to the bindingsource of
its parents, no items are available to select in the DataMember
dropdown.

So I set it up as you did in the Load event. It won't even load the
form because it cannot find one of the properties associated with the
Child bindingsource.

PersonBindingSource.DataSource = ClientBindingSource
PersonBindingSource.DataMember = "FK_Client_Person"

System.ArgumentException was unhandled
Message="Cannot bind to the property or column FirmName on the
DataSource.
Parameter name: dataMember"

Can you think of any reason that it cannot see the DataMember?

Flomo

On Sun, 28 Jan 2007 21:11:13 -0800, "RobinS" <RobinS@NoSpam.yah.none>
wrote:

>For the children, you need to bind them to the data relation with the
>parent table instead of the child table. Then when you move through the
>records of the parent, the children will change as well.
>
>Here's an example that runs against Northwind using the
>Customers and Orders tables.
>
>* Dim ds as CustomersDataSet = CustomersDataSet.GetCustomers()
>*
>* m_CustomersBindingSource.DataSource = ds
>* m_CustomersBindingSource.DataMember = "Customers"
>* m_CustomersGrid.DataSource = m_CustomersBindingSource
>*
>* m_ChildOrdersBindingSource.DataSource = m_CustomersBindingSource
>* m_ChildOrdersBindingSource.DataMember = "FK_Orders_Customers"
>*
>* m_OrdersGrid.DataSource = m_ChildOrdersBindingSource
>
>Robin S.
>----------------------------------------------
>"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
>news:efcqr2hq32mk1j9e9tq4rndn3n344e06qd@4ax.com...
>>I have defined a dataset using the DataSource Configuration Wizard. I
>> dropped 3 tables onto the design surface. It looks like this:
>>
>> Tbl1 Tbl2 Tbl3
>> PK
>> FK========> PK
>> FK=========>PK
>>
>> Table 1 is a Client, tbl2 is a Person and 3 is an Address.
>> There is only one Person for a Client and only one Address for a
>> Person.
>>
>> When I look at the relations the designer created, it says that for
>> the Client-Person relation, the Person is the parent and the child is
>> the Client. The relation editor will not allow me to change this.
>>
>> I created a bindingsource for the client. I set its datasource
>> property to the dataset and table Client to the DataMember property. I
>> created another bindingsource, PersonBindingSource, and set is
>> datasource to the dataset and the Person table to the DataMember
>> property. Finally I created an Address bindingsource and set its
>> datasource to the dataset and its Address table to the DataMember
>> property.
>>
>> I used a bindingnavigator. When I move from row to row with the
>> navigator, only those controls bound to the client binding source
>> reflect the navigation. The controls bound to either the Person or
>> Address do not.
>>
>> I must be missing something basic. Can someone please help?
>>
>> Thanks
>

Re: BindingSource, DataSet and multiple tables not syncing by RobinS

RobinS
Mon Jan 29 00:28:14 CST 2007

This message seems to indicate that there are fields involved in the FK
that are not in the datatable. Is that true?

According to your original post, the Person is the parent and the Client is
the child. The only way to move through the records together if you can't
change that is by using the Person as the parent instead of the Client.

I don't understand why you can't change the relation, unless that's how it
is defined in your original data source (database).

Robin S.
-----------------------------------
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:3m1rr2p0bi3k7pp6012lso7vt6io09g83j@4ax.com...
> Thanks for the response Robin.
>
> I set all the binding properties in the Property window. When I select
> the child bindingsource and set its datasource to the bindingsource of
> its parents, no items are available to select in the DataMember
> dropdown.
>
> So I set it up as you did in the Load event. It won't even load the
> form because it cannot find one of the properties associated with the
> Child bindingsource.
>
> PersonBindingSource.DataSource = ClientBindingSource
> PersonBindingSource.DataMember = "FK_Client_Person"
>
> System.ArgumentException was unhandled
> Message="Cannot bind to the property or column FirmName on the
> DataSource.
> Parameter name: dataMember"
>
> Can you think of any reason that it cannot see the DataMember?
>
> Flomo
>
> On Sun, 28 Jan 2007 21:11:13 -0800, "RobinS" <RobinS@NoSpam.yah.none>
> wrote:
>
>>For the children, you need to bind them to the data relation with the
>>parent table instead of the child table. Then when you move through the
>>records of the parent, the children will change as well.
>>
>>Here's an example that runs against Northwind using the
>>Customers and Orders tables.
>>
>>* Dim ds as CustomersDataSet = CustomersDataSet.GetCustomers()
>>*
>>* m_CustomersBindingSource.DataSource = ds
>>* m_CustomersBindingSource.DataMember = "Customers"
>>* m_CustomersGrid.DataSource = m_CustomersBindingSource
>>*
>>* m_ChildOrdersBindingSource.DataSource = m_CustomersBindingSource
>>* m_ChildOrdersBindingSource.DataMember = "FK_Orders_Customers"
>>*
>>* m_OrdersGrid.DataSource = m_ChildOrdersBindingSource
>>
>>Robin S.
>>----------------------------------------------
>>"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
>>news:efcqr2hq32mk1j9e9tq4rndn3n344e06qd@4ax.com...
>>>I have defined a dataset using the DataSource Configuration Wizard. I
>>> dropped 3 tables onto the design surface. It looks like this:
>>>
>>> Tbl1 Tbl2 Tbl3
>>> PK
>>> FK========> PK
>>> FK=========>PK
>>>
>>> Table 1 is a Client, tbl2 is a Person and 3 is an Address.
>>> There is only one Person for a Client and only one Address for a
>>> Person.
>>>
>>> When I look at the relations the designer created, it says that for
>>> the Client-Person relation, the Person is the parent and the child is
>>> the Client. The relation editor will not allow me to change this.
>>>
>>> I created a bindingsource for the client. I set its datasource
>>> property to the dataset and table Client to the DataMember property. I
>>> created another bindingsource, PersonBindingSource, and set is
>>> datasource to the dataset and the Person table to the DataMember
>>> property. Finally I created an Address bindingsource and set its
>>> datasource to the dataset and its Address table to the DataMember
>>> property.
>>>
>>> I used a bindingnavigator. When I move from row to row with the
>>> navigator, only those controls bound to the client binding source
>>> reflect the navigation. The controls bound to either the Person or
>>> Address do not.
>>>
>>> I must be missing something basic. Can someone please help?
>>>
>>> Thanks
>>



Re: BindingSource, DataSet and multiple tables not syncing by Flomo

Flomo
Mon Jan 29 15:01:35 CST 2007

Thanks for the push, Robin. I figured out how to change the
relationships. I wasn't setting the columns properly.

Re: BindingSource, DataSet and multiple tables not syncing by RobinS

RobinS
Mon Jan 29 17:46:59 CST 2007

Woo-hoo! Congratulations!
Robin S.
-----------------
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:u3osr254rfpjom76dntgkekrq0ja4m10b7@4ax.com...
> Thanks for the push, Robin. I figured out how to change the
> relationships. I wasn't setting the columns properly.