hi people
i realise that this is a subject that has been covered a lot here but can't quite seem to nail this problem i'm having....
i have a vb.net 2008 frontend with access 2008 database. Parent 'DGV Clients' and Child 'DGV Orders' on a form. They are linked successfully but my problem lies in making updates.
If i add a new client and then an order for the new client, it appears to save ok, but when i try and reload the app. i get the error message that 'ContraintException was unhandled' on my Orders tableapapter.fill.
i can see what the problem is if i open my access database directly. the new Client is being added to the database and being assigned PK of ClientID, but the Child record is not changing to the same ID and is staying with -1. Hence, when i try to reopen the app i get the problem.
I have set up Relation and Foreign key constraints on the relation to 'cascade'. Changed update code of table adapters to update as follows
as i understand that the database needs to obviously add parent records to the db first. i am sure i am missing something simple here????
any help greatly appreciated.
i realise that this is a subject that has been covered a lot here but can't quite seem to nail this problem i'm having....
i have a vb.net 2008 frontend with access 2008 database. Parent 'DGV Clients' and Child 'DGV Orders' on a form. They are linked successfully but my problem lies in making updates.
If i add a new client and then an order for the new client, it appears to save ok, but when i try and reload the app. i get the error message that 'ContraintException was unhandled' on my Orders tableapapter.fill.
i can see what the problem is if i open my access database directly. the new Client is being added to the database and being assigned PK of ClientID, but the Child record is not changing to the same ID and is staying with -1. Hence, when i try to reopen the app i get the problem.
I have set up Relation and Foreign key constraints on the relation to 'cascade'. Changed update code of table adapters to update as follows
VB.NET:
ClientsTableAdapter.Update(Bd1DataSet.Clients)
OrdersTableAdapter.Update(Bd1DataSet.Orders)
as i understand that the database needs to obviously add parent records to the db first. i am sure i am missing something simple here????
any help greatly appreciated.