D
divisortheory
I have two tables. First table is like this:
TABLE PrimaryTable
----Guid PrimaryID (Primary Key)
----string PrimaryName
----int PrimaryValue
Second table is like this:
TABLE SecondaryTable
----Guid SecondaryID
----Guid PrimaryID
There is a relationship defined between PrimaryTable.PrimaryID and
SecondaryTable.PrimaryID, and Enforce Referential Integrity is set to
true (downward and upward cascading are both set to false)
I insert a row into PrimaryTable, then a row into SecondaryTable with
the same Guid as in the PrimaryTable. In this row, PrimaryValue = 1.
Later, I get the row from PrimaryTable and set PrimaryValue to 2. When
I perform my update, I get this error:
"The record cannot be deleted or changed because table 'SecondaryTable'
includes related records."
Comparing the debugger and the live database side by side, I've
confirmed that the live database's view and the DataRow's modified view
differs only in the value of PrimaryValue.
Why should this fail, and how can I fix it without turning off
referential integrity checking? It's seems like a legitimate update to
me.
TABLE PrimaryTable
----Guid PrimaryID (Primary Key)
----string PrimaryName
----int PrimaryValue
Second table is like this:
TABLE SecondaryTable
----Guid SecondaryID
----Guid PrimaryID
There is a relationship defined between PrimaryTable.PrimaryID and
SecondaryTable.PrimaryID, and Enforce Referential Integrity is set to
true (downward and upward cascading are both set to false)
I insert a row into PrimaryTable, then a row into SecondaryTable with
the same Guid as in the PrimaryTable. In this row, PrimaryValue = 1.
Later, I get the row from PrimaryTable and set PrimaryValue to 2. When
I perform my update, I get this error:
"The record cannot be deleted or changed because table 'SecondaryTable'
includes related records."
Comparing the debugger and the live database side by side, I've
confirmed that the live database's view and the DataRow's modified view
differs only in the value of PrimaryValue.
Why should this fail, and how can I fix it without turning off
referential integrity checking? It's seems like a legitimate update to
me.