How to do hierarchial update of tables from Windows forms Applications

I have three tables. Customers and orders and Items.  Each one is hierarchically connected to another. I have databind all the controls and datagrid to binding source.

How to update all the tables by calling binding source.endedit
Niyas MaraicarAsked:
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
So you have TableRelations set on those 3 tables in your project? If so, are you sure you've configured cascading Updates (and Deletes, if appropriate) for those relations? They're generally set by default, but it's a good idea to ensure that.

Are you using a TableAdapterManager? If so, then you would just call the UpdateAll method, and the TableAdapter would take care of the updates for you in the correct order.

If you're not using a TableAdapter, then you'd have to explain a little further about how you've got everything setup.
Gustav BrockCIOCommented:
If new records are added, first update Customers, then Orders, finally Items.

If no new records, you can update in any sequence.

Niyas MaraicarAuthor Commented:
Thanks Mr.Gustav and Mr.Scott.

I apologize for my question is too general to assist.

Thanks Scott for giving a direction towards solution.

TableAdapterManager .UpdateAlll is not updating.

Table relationship are all set.

Whether binding source should be dragged from datasource windows?

I have dragged it from tool box and set the datasource. Is it wrong?
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Niyas MaraicarAuthor Commented:
OK. I am explaining what I have done.

I designed DB with relations
I design Form controls
I drag Binding source and set Datasource
When run, only main binding source is get updated.

Kindly suggest
Niyas MaraicarAuthor Commented:
The first customer table is getting updated from the form controls


And the second orders dataset is empty and not updating eventhough the controls are mapped with databindings

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
If the second Orders dataset is empty, there's nothing to save.

Does the user enter data into the Orders dataset? Or is this filled in some other manner?
Niyas MaraicarAuthor Commented:
There is a virtual method in Base page returning BindingSource Type.

   protected virtual BindingSource MainBindingSource { get { return null; } }

and only the mainbinding source given in  the overriden method is working

protected override BindingSource MainBindingSource
            get { return CustomersBindingSource;; }

Any suggestions.
Niyas MaraicarAuthor Commented:
Binding source is empty. I planned to use enitty framework
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.