gt5149c wrote:
I have a theory on the problem. I have inheritance turned on and physical inspection is has a foreign key to Event and its primary key is ID. ID is an identity on the Event table. Could it be confused when I say ID and be referencing the Event table?
I traces the database and it creates a new Event and then updated the ID for physical inspection. I does this even when I retrieve the correct event before I hit save.
Any ideas?
Ah, but then it's intented behavior.
If you have PhysicalInspection which is a subtype of Event, then the PK of Event is also the PK of PhysicalInspection ENTITY, as Event is part of PhysicalInspection. The PK of the PhysicalInspection TABLE is also an FK, so always dependent on the value inserted in Event.
When you set the field, it's ignored, as it's an identity field. this means that the event's new PK value is synced with the PK of the PhysicalInspection TABLE, so the PK in that table points to the right Event row (as it's an FK)