DELETE: foreign key constraint violated |
Patrick |
2013-12-12 02:29:41 |
Hello,
I have two tables with a many-to-one relationship. In MS Access, this relation has "check data integrity" enabled, that means if I try to delete a record that has a relationship to existing records in the other table, it will raise an error.
With HXTT driver, the same delete on the same record is possible, with no error whatsoever, resulting in a DB that is not valid anymore.
What did I miss?
|
Re:DELETE: foreign key constraint violated |
HXTT Support |
2013-12-12 02:44:12 |
>With HXTT driver, the same delete on the same record is possible,
> with no error whatsoever, resulting in a DB that is not valid anymore.
HXTT Access supports cascading updates and cascading delete. If you meet issue, please email us your sample.
|
Re:Re:DELETE: foreign key constraint violated |
Patrick |
2013-12-12 02:48:59 |
It's not a matter of cascading. It should not be possible to delete a row that has this relationship with "check references integrity = true".
MS Access client does not allow it.
|
Re:Re:Re:DELETE: foreign key constraint violated |
HXTT Support |
2013-12-12 02:56:13 |
>"check references integrity = true".
HXTT Access checks also references integrity too. In my memory, for many-to-one relationship, you can delete a row of many relation side, but can't delete a row of one relation side before there's any data row of many relation side.
|
Re:Re:Re:Re:DELETE: foreign key constraint violated |
Patrick |
2013-12-12 04:49:14 |
|
You're right, but the problem appears when deleting on the "one"-side of the relationship, and when there are still records on the "many" side.
|
Re:Re:Re:Re:Re:DELETE: foreign key constraint violated |
HXTT Support |
2013-12-12 05:39:15 |
Tested. It will throw
Failed to delete record from table ef because primary key referential integrity.
if you delete on the "one"-side of the relationship
|
Re:Re:Re:Re:Re:Re:DELETE: foreign key constraint violated |
Patrick |
2013-12-12 07:13:55 |
Ok we found out where the problem is.
In MSACCESS there are three different settings for a relationship definition:
1. "check reference integrity" -> is used to make sure that a record cannot be deleted when referenced in another table, and is on the "one"-side of a one-to-* relationship.
2. "cascade fields changes" -> will change in all records that reference this one
3. "cascade deletes" -> will delete all records that reference this one.
Prolem occurs when only the first setting is set. A DELETE will be accepted without error by HXTT Driver, but not by MS Access.
HXTT Driver should be modified.
P.S. My Mother always told me that relationships are sometimes difficult...
|
Re:Re:Re:Re:Re:Re:Re:DELETE: foreign key constraint violated |
HXTT Support |
2013-12-12 07:16:35 |
>Prolem occurs when only the first setting is set. A DELETE will be accepted without error by HXTT Driver, but not by MS Access.
In my test, it will throw Failed to delete record from table ef because primary key referential integrity.
if you delete on the "one"-side of the relationship
So please email us your sample.
|
Re:Re:Re:Re:Re:Re:Re:Re:DELETE: foreign key constraint violated |
Patrick |
2013-12-12 07:17:56 |
Sorry the problem occurs when the first TWO settings are set.
We want to check integrity and cascade changes (such as Primary Key modification), but not deletes.
|
Re:Re:Re:Re:Re:Re:Re:Re:DELETE: foreign key constraint violated |
HXTT Support |
2013-12-13 00:35:42 |
|
Supported now. Please download it.
|
Re:Re:Re:Re:Re:Re:Re:Re:DELETE: foreign key constraint violated |
Patrick |
2013-12-13 00:50:11 |
Great, it works.
Thanks for your support.
|