Reason -
The moment first table in the dataset is populated, ALL constraints are enforced. This means there will be some parent tables which will not be populated, which will give rise to an exception.
You can't act smart and return all parent tables in one data set and populate them in one go using DataAdapter.TableMappings, because this exception will be thrown the moment first table is mapped to dataset.
The only workaround I could think of was to do the following:
- Populate all parent tables in one method and ensure that this method is called before any other data operation or population method.
- In this method, set EnforceConstraints to false before starting data retrieval and set it back to true once the retrieval is complete.
Ideal behaviour -
Only the constraints related to the populated datable should be activated.
No comments:
Post a Comment