I have 3 tables in my dataset with bindings to textboxes that work great. I want to add another table and set additional bindings with textboxes, but I am not sure if it is possible. I have added a LINQ query that grabs the data needed, but I would prefer using another binding source. I would like to know if adding additional bindings for textboxes for another table is possible and how to go about it.
The 3 tables that I do not have any problems with are related.
The parent table is "Contracts", and it has a "ContId" field as the PK.
The code is:
Code:
//Contracts Binding
bsContracts = new BindingSource();
bsContracts.DataSource = dsPlanning; //DataSet
bsContracts.DataMember = contracts.TableName; //DataTable
I have a child table called "Link_Contract_Letting" and it has 2 FKs "ContId" and "LetId"
The code is:
Code:
//Links Binding
bsLinks = new BindingSource();
bsLinks.DataSource = bsContracts; //Master binding source bsLettings
bsLinks.DataMember = "ContToLink"; //"ContToLink" is the data relationship between the Contracts and Link tables.
I have a second child table called "Deses" and it has 1 FK "ContId"
The code is:
Code:
//Deses Binding
bsDeses = new BindingSource(); //Deses has a Details relationship to Contracts as in Master to Details. Therefore this binding is different.
bsDeses.DataSource = bsContracts; //Master binding source bsContracts
bsDeses.DataMember = "ContToDes"; //"ContToDes" is the data relationship between the Contracts and Deses tables.
In addition I have 2 binding navigators and the code is:
Code:
//Bind to Binding Navigator
bnContracts.BindingSource = bsContracts;
bnDeses.BindingSource = bsDeses;
I want to add a parent table to the "Link_Contract_Letting" table called "Lettings" and it would be related to the "Link_Contract_Letting" table through a PK called "LetId".
I have tried several ways to bind the additional table and I get an error stating "Cannot bind to the property or column 'Letting_Date' on the DataSource."