I have two tables (Person and Company). Both tables have a field 'Id' (e.g. Person.Id and Company.Id) and the tables are joined on Person.CompanyId = Company.Id
When using DataBindings.Add() to a textbox for example - using WinForms and VB .Net - I would like to use method suggested by Microsoft namely:
txtPersonId.DataBindings.Add("Text", objDataView, "Person.Id")
txtCompanyId.DataBindings.Add("Text", objDataView, "Company.Id")
In this case, I get the following error however: "Child list for field Person cannot be created". After some fiddling around, it looks like 'Person' is looked up as a field in objDataSet instead of 'Person.Id'.
After I change the SQL query and have Person.Id returned as the alias 'PersonId' and Company.Id as 'CompanyId' the following code does work:
txtPersonId.DataBindings.Add("Text", objDataView, "PersonId")
txtCompanyId.DataBindings.Add("Text", objDataView, "CompanyId")
My question is therefor: Why is the Microsoft example not working here (see example here) and how can one include the table name in a DataBindings.Add() method otherwise?