Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Winforms Master-Details BindingSource Does Not Update

$
0
0

I am working in WinForms and C# in VS 2010, and I have standalone DataSet (i.e. there is no database;  it is stored as an XML file between program executions.)  The DataSet, calledOptimizer, has a pair of tables that have a one-to-many relationship:IgCombos (parent) and IgGlassList (child). 

The relationship between the tables is called FK_IgCombos_IgGlassList.  This relationship has the Parent Table (IgCombos) Key Column =IgComboID, and the Child Table (IgGlassList) Foreign Key Column also set toIgComboID, which is the column in IgGlassList that holds that foreign value.  The relationship is both a Relation and a Foreign Key Constraint, and it has cascading Updates and Deletes.

I've been using the Data Sources window to create a Master-Details form: I pulled the IgCombos data onto the form as individual items; this createdigCombosBindingSource.  Then I found the version of IgGlassList that is under IgCombos, as created by the relationship, and dragged that onto the form as a DataGridView; this created a DataGridView calledigGlassListDataGridView, and also igGlassListBindingSource

The relevant properties of the form items are as follows:

  • igCombosBindingSourcehas DataSource = optimizer and DataMember = IgCombos 
  • igGlassListBindingSourcehas DataSource = igCombosBindingSource and DataMember = FK_IgCombos_IgGlassList
  • igGlassListDataGridViewhas DataSource = igGlassListBindingSource 
  • The individual columns in the DataGridView have DataPropertyName = the related column name in igGlassList

Okay, I think that's everything about the setup.  The problem is that the DataGridView is not displaying any of the data from the child table.  I manually put some data into the table in the background, and I made sure the IgComboID matches between my entries in the two tables.  So I know there is some linked data.  But though I can use the BindingNavigator to move through my IgCombos data, and that data shows up properly in the related textboxes, nothing ever shows up in my DataGridView.  Data that I type into the IgGlassList DGV lasts until I go to the next IgCombo record; then it disappears into the ether - it doesn't come back when I return to that record, and it doesn't show up in any table afterward.

Everything I've found on this subject indicates I have it set up properly.  So why doesn't it work?

Thanks much,

Doug


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>