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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
If new records are added, first update Customers, then Orders, finally Items.

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

/gustav
0
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook 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
0
Niyas MaraicarAuthor Commented:
The first customer table is getting updated from the form controls

            CustomersBindingSource.EndEdit();
            CustomersTableAdapter.Update(customData.Customers);

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

            OrdersBindingSource.EndEdit();
            OrdersTableAdapter.Update(customData.Orders);
0
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?
0
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.
0
Niyas MaraicarAuthor Commented:
Binding source is empty. I planned to use enitty framework
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.