I have a form that has a set of textboxes and a datagrid, i've currently setup 2 binding sources and one dataset containing the 2 tables and the relation, the first BS is the master BS, all the textboxes in the form are bound to this BS, the second BS has the Datasource bound to the the First BS and the datamember is set to the relation, the datagrid is bound to this BS.
The select operation works fine, the Update operations work fine as well, the problem comes with saving when adding a new record, the first BS does not save data at all and the child saves the record but the relation field gets saved with -1, obviously that's because the parent is not set at the time of saving so the proper ID field does not get relayed.
What I have tried:
I've tried the Addnewrow method to no avail, i've tried the AcceptChanges, GetChanges etc with no result, the tableadapter.update simply will not save data back to db, no error is presented , i've tried to debug using Onrowupdating and RowUpdated with no result, connection is ok, the table adapter has all the commands ( Insert, update, Delete, Select). i've tried using a tableadaptermanager with no result.
the last thing i just tried was using transactions and still it does not save back to the db.
In short the question would be what's the proper way to setup such scenario: I.E
2 Tables (Orders, OrderDetails)
1 dataset with this 2 tables and a relation on the OrderID field
2 tables adapters one for each table
2 bindingsources : one binding the Orders textboxes and one binding the datagrid for Orders Details.
I know how to do this manually, what i would like to know is how to automate all of this using the bindingsources since that's the whole point and doing it manually would defeat the purpose i'm looking for here.