Changing DataMember error?

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"] }; }


7 Replies 1 reply marked as answer

SS Sampathnarayanan Sankaralingam Syncfusion Team January 4, 2022 02:34 PM UTC

Hi Ehs psy, 
 
We are validating the reported issue. We will update you with the proper details on January 6, 2022. 
 
Regards, 
Sampath Narayanan.S 



SS Sampathnarayanan Sankaralingam Syncfusion Team January 6, 2022 04:06 PM UTC

Hi ehs psy, 
 
We have tried to check the issue but we couldn’t able to find exact scenario. Please provide the video illustration and simple sample to reproduce the issue. It will be helpful for us to check on it and provide you the solution at the earliest. 
 
Regards, 
Sampath Narayanan. 



AL ali replied to Sampathnarayanan Sankaralingam January 6, 2022 06:01 PM UTC

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.



SS Sampathnarayanan Sankaralingam Syncfusion Team January 7, 2022 02:22 PM UTC

Hi ehs psy, 

Based on provided information, we have prepared the simple sample based on your requirement. 


 Please have a look at this sample and let us know if you have any concerns in this. 

Regard, 
Sampath Narayanan.S 



EP ehs psy replied to Sampathnarayanan Sankaralingam January 9, 2022 03:14 PM UTC


Hi

for now i am saving the schemas to the hard drive then loading it again and again.

error 1.jpg.

Thanks.



SS Sampathnarayanan Sankaralingam Syncfusion Team January 10, 2022 02:43 PM UTC

Hi ehs psy,


We are able to reproduce the issue. We will validate your reported issue and update you on January 12, 2022.


Regards,
Sampath Narayanan.S




SS Sampathnarayanan Sankaralingam Syncfusion Team January 12, 2022 01:47 PM UTC

Hi ehs psy, 

We have checked the sample in the mentioned aspect. The schema of the previous DataSource can be cleared by setting GridGroupingControl.DataSource to null before changing the DataSource to the same GridGroupingControl. Please refer the below code snippet. 

Code Snippet: 
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(); 
} 


Please let us know if you have any concerns in this.  

Regards, 
Sampath Narayanan.S 


Marked as answer
Loader.
Up arrow icon