Help with table relations

Geoffrey Thompson 21 Reputation points
2022-03-10T01:25:28.283+00:00
I have just moved to Visual Studio after working for years with MS Access VB, and have imported my .mdb database into the project. I am using WPF with .net framework 4.7.2. I have a main dataset called Table1 with several child tables to which Table1 has one to many relations around a single key column set as both relation and foreign key constraint. The update rule is set as default.

My difficulties are several:
1. When I select a record in table 1, which appears on the main window with the child tables, I see no data in any of the childs even though I know data exists for these records. What setting do I need to see these child data?
2. I have dragged the fields from Table 1 which are used for data entry and/or display onto the main window, but if I change data values within the text box controls the changes are shown immediately in Table 1, but are not saved when I leave VS. How do I save them back to the .mdb database?
3. Finally, I want to be able to search records in Table 1 and have data from the single found record appear in the fields in the main window. I don't seem to be able to use usual keys such as Crtl-F - how do I search?

Hope this makes sense, would appreciate any help. 
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,710 questions
{count} votes

Accepted answer
  1. Geoff Thompson 76 Reputation points
    2022-03-10T11:03:17.703+00:00

    Thanks HuiLiu, the import was done with the Visual Studio database tool, so I simply dragged and dropped the main and child tables from the tool. I’ll take a screenshot in a minute, not sure how to create a minimal project, remember I am a novice at WPF

    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Geoffrey Thompson 21 Reputation points
    2022-03-10T11:31:57.553+00:00

    181922-image.png

    0 comments No comments

  2. Geoffrey Thompson 21 Reputation points
    2022-03-10T11:36:15.097+00:00

    HuiLiu, here is a screen shot of the main window as it currently stands. You can see that the data from the MS Access database appears in the Table 1 in the top right corner, and the data is populated in the individual control boxes at the top, simply by clicking on the test1 record in the Table 1. However, no data appear in the other tables which are linked as child relations to Table 1 - I will post the dataset.xsd screen below to partly show the table relations.

    181933-image.png

    0 comments No comments

  3. Geoffrey Thompson 21 Reputation points
    2022-03-10T11:37:08.977+00:00

    Does this help?

    0 comments No comments

  4. Geoff Thompson 76 Reputation points
    2022-03-11T11:03:16.663+00:00

    I dont know if I can revive this topic, but I accepted HuiLiu’s answer thinking it was the right thing to do, but it seems to have closed of discussion, whenI dont have a solution. Can I somehow revive the discussion?

    0 comments No comments