private DataTable Table_c; // Table_c is imported from a local database private DataTable Table_a; // Table_a is imported from a local database private DataSet tblDataSet; private void Form1_Load(object sender, EventArgs e) { this.table_aTableAdapter1.Fill(this.DBDataSet1.Table_a); this.table_cTableAdapter.Fill(this.DBDataSet1.Table_c); tblDataSet = new DataSet(); tblDataSet.Tables.Add(Table_c); tblDataSet.Tables.Add(Table_a); tblDataSet.Relations.Add("Relation1", Table_c.Columns["Number"], Table_a.Columns["Number"]); BindingSource bsC = new BindingSource(); bsC.DataSource = tblDataSet; bsC.DataMember = "Table_c"; BindingSource bsA = new BindingSource(); bsA.DataSource = bsC; bsA.DataMember = "Relation1"; table_cDataGridView.DataSource = bsC; table_aDataGridView.DataSource = bsA; }
column argument cannot be null.Parameter name: column
tblDataSet.Relations.Add(Relation1, Table_c.Columns["Number"], Table_a.Columns["Number"]);
this.DBDataSet1.Table_c
"DataTable already belongs to another DataSet"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)