I want to have one dataset with two tables and change between them at run time.
But when I move a column in one of the tables then change to the other one, the grid is empty and the schema of the first one is alwaysshowing.
private void Button1_Click_1(object sender, EventArgs e) { FbDataAdapter da = new FbDataAdapter(sql_select_RH, fb); da.SelectCommand.Transaction = fb.BeginTransaction(); da.Fill(dataSet1, "RH"); da.SelectCommand.Transaction.Commit(); dt2 = dataSet1.Tables["RH"]; dt2.PrimaryKey = new[] { dt.Columns["NUMERO"] }; this.gridGroupingControl1.DataSource = dt2;//or this.gridGroupingControl1.DataMember = "RH" } private void Button2_Click(object sender, EventArgs e) { FbDataAdapter da = new FbDataAdapter(sql_select_POSTES, fb); da.SelectCommand.Transaction = fb.BeginTransaction(); da.Fill(dataSet1, "postes"); da.SelectCommand.Transaction.Commit(); dt = dataSet1.Tables["postes"]; this.gridGroupingControl1.DataSource = dt;//or gridGroupingControl1.DataMember = "postes"; dt.PrimaryKey = new[] { dt.Columns["N"] }; }
I just want to use one GridGroupingControl with several datatbles
and change between them without losing
the schema .
If I move a column
in
‘RH’ table then change the datamember è
<gridGroupingControl1.DataMember = "postes"; //showing
‘postes’ table
>
‘postes’ table shows empty with ‘RH’
table schema .
Thank you very much.
Hi .
for now i am saving the schemas to the hard drive then loading it again and again.
.
Thanks.
|
private void button1_Click(object sender, EventArgs e)
{
ViewModel viewModel = new ViewModel();
this.gridGroupingControl1.DataSource = null;
this.gridGroupingControl1.DataSource = viewModel.GridItemSource2;
this.gridGroupingControl1.Table.Reload();
this.gridGroupingControl1.TableControl.Refresh();
} |