Strange configuration choices - 02-11-2009 , 08:25 PM
I have converted a table from autnums to natural keys and suddenly my
application goes totally wrong. I cannot commit any changes.
I am using the generated typesafe classes and the generated classes are
set up so that they give you:
The record cannot be deleted or changed because table YYY includes related
I found this:
parent table has a primary key parent_id
child table has a primary key parent_id, child_id
foreign key is defined for parent_id
dataset generated with all the propery keys and relationships
I get the error when trying to update the parent table unless i manually
change the Dataset.Designer.vb to remove the parent_id from the set
of the update command.
Why does the generated SQL update statements automatically include the
primary key that automatically breaks the ability to update the records
if it is a primary key on another relationship.
Is there a fundamentally better design here? This has cost me a couple
of days figuring it out.
Re: Strange configuration choices - 02-12-2009 , 05:49 AM
I eventually got this working by:
Using configuration to build the SQL statements.
Editing the Update SQL in the Table Adaptor, removing the primary keys
from the update (set clause)
There were still some residual problems. So I then looked at the SQL
again and I had to remove all but the primary keys from the where
clause. This now works correctly.
|Thread Tools||Search this Thread|