I have two tables: Customer and Order. I fill the tables to dataset, add relation to dataset and bind to datasources:
var customerDs = _customerDAO.ExecuteSelectCommand(_customerCmd.SelectCommand, _customerCmd.TableName); var orderDs = _orderDAO.ExecuteSelectCommand(_orderCmd.SelectCommand, _orderCmd.TableName); _ds = new DataSet(); _ds.Tables.Add(customerDs.Tables.Copy()); _ds.Tables.Add(orderDs.Tables.Copy()); var relation = new DataRelation("CustomerOrderRelation", _ds.Tables["Customer"].Columns["id"], _ds.Tables["CustomerOrder"].Columns["Customer_id"]); _ds.Relations.Add(relation); _customerBs = new BindingSource(); _customerBs.DataSource = _ds; _customerBs.DataMember = "Customer"; _orderBs = new BindingSource(); _orderBs.DataSource = _customerBs; _customerBs.DataMember = "CustomerOrderRelation";
But the error
"DataMember property 'CustomerOrderRelation' cannot be found on the DataSource" thrown on "_customerBs.DataMember = "CustomerOrderRelation";"
What the problem? I can't figure that out!