How to refresh the result of a Join in a dataset RRS feed

  • Question

  • I have a dataset with many tables.  Two tables are of interest in the question.  The S table and the ConfigurationSets table.  The S table contains a column, ActiveConfiguration, which relates to the key column, Id, in the ConfigurationSets table.  This key is actually a Guid so it is not people friendly.  The ConfigurationSets table also contains a Name column which is the people friendly name of the set.

    I want to display via WPF and databinding some of the columns in the S table in a ListView.  In there I want to display the people friendly name instead of the Guid of the corresponding ConfigurationSetsRow.

    I have the following query defined for the S table.
    SELECT  s.Id, s.Name, cs.Name AS Expr1  
    FROM Servers AS s LEFT OUTER JOIN ConfigurationSets AS cs ON s.ActiveConfiguration = cs.SetId 

    One of the 'columns' in the S table is ActiveConfigurationName that has a source of Expr1.  I then  simply bind the ListView column to ActiveConfigurationName and this works great until I update the ActiveConfiguration column in the S table. 

    I have debugged and the new value of s.ActiveConfiguration is committed to the database and is in the in memory dataset, but the ActiveConfigurationName column is not refreshed.

    How do I force the ActiveConfigurationName to refresh when s.ActiveConfiguration is updated.

    I cannot simply completely rebuild the in memory dataset, because other rows in these and other tables could be in the process of being edited.
    Thanks Roy
    Tuesday, March 24, 2009 7:15 PM

All replies

  • I may have missed something but have you tried setting the DataRelation to be a Relationship AND Constraint? It sounds like maybe the DataRelation is simply a Relation, which may prevent the changes from cascading in the bindings.

    Thursday, March 26, 2009 4:45 PM
  • Many thanks for your help, but that did not fix the problem. 

    While I do have a Relation defined in the DataSet between the two tables, I am not using it to retrieve the data in question.  (In fact setting it to be a constraint also quickly showed me that my relation was wrong and not being used.)  This could well be my problem.  Mind you I am really a novice at relational data and DataSets.  I know enough to get in trouble.

    If you can explain to me how to do what I am doing short of writing a WPF converter that would perform the query needed to translate the Guid to the people name, I would be most appreciative.

    Thanks Roy
    Thursday, March 26, 2009 5:38 PM