I have tables [Cases] and [CDegrees] with relacion [Cases].[CID] - [CDegrees].[CID]. [CID] is PK of [Cases] with AutoIncrement. Both tables are used in one form and it's assumed that user can add new records to both tables same time and than save whole master/child data in one GUI action. So in Dataset where I created FK I set "Both Relation and Foreign Key Constraint" to ensure during update of new record in Cases table, retrieved IDENTITY value will cause child records to update from -1 to retrieved [CID] value. When I update [Cases] adapter, it causes to retrieve an new IDENTITY value and cascade update in [CDegrees] child record works ok too. But [CDegrees]'s update causes Insert script with [CID]=-1 (original value). I changed Insert parameter [@CID] of [CDegrees] to "Proposed" version but same happens (seen in SQL Profiler). Actually my task is mach more complicated, I just simplified task to localize my problem. Any ideas?
Aucun commentaire:
Enregistrer un commentaire