Click here to Skip to main content
14,921,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to ask if someone could please help me to understand how to update the child relation that I have. I have a "customers" table and then "accounts" table and the accounts is the child. I can successfully save information to the customers table:

me.validate()
me.CustomersBindingSource.Endedit()
me.CustomersAccountsBindingSource.Endedit() "child"
me.TableAdapterManager1.UpdateAll(me.Shopdataset)

I don't have an issue displaying the information on my datagridviews when I am running the program. After I have closed the program and then restarted the program, I can see that I customers data is there but all the customer's account data is missing.

Thank you in advance.

What I have tried:

I have tried updating all of the binding sources. I have also tried to add a binding navigator and inserted the standard tools with the save button, and tried using the save button to save.
Posted
Updated 11-Jan-17 20:26pm
v2

1 solution

Based on this article: Walkthrough: Saving Data from Related Data Tables (Hierarchical Update)[^] - you have to change Hierarchical Update property to true.

Try!
   
Comments
Member 12945726 12-Jan-17 10:56am
   
I will try that. Thank you!!
Maciej Los 12-Jan-17 16:03pm
   
You're very welcome. If it helps, please, mark my solution as an answer (green button).
Member 12945726 13-Jan-17 11:07am
   
Okay so I fixed the issue but it had nothing to do with what I was doing or the hierarchical update. I found a bug in Visual Studio. If you have a datagrivdiew and you connect a dataset to it and then you connect the datagridview to it before actually going back to the dataset designer and setting the relation the bug sets in! Thank you Macie for your help!! I just have one more question. Now that I had made it past that step, now I cannot get past an exception of "duplicate key error"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900