T
Theo
Dear friends,
a summary of my problem: Update method adds new row in the
database (as expected) but then raises an exception as if
it failed to update.
I have a form with binded controls. Most of them bind to a
main table and some of them bind to a secondary table.
These tables are related to each other (One to One
relation in the back end database) but this relation is
not implemented in any way on the dataset. I just use a
query to get the second table based on the key value of
the main table.
The possible scenarios when filling the dataset are:
Main Table | Second Table
Key Value | Related Key Value
======================================
Exists | Exists
Exists | Does not exist
Does not exist | Does not exist
When rows exist in both tables, updates works fine.
When row exists only in main table, i create a new row in
the second table and updates work fine
When none of the tables return a row i create a row in the
first table, update it (works fine) and then i create a
row in the second table and try to update it. An exception
is raised that key value cannot be null and that a key
value must exist in the related table (the fist table). I
check the database and row has been added in the table.
Why is the exception raised then???
There is no relation between the two tables within the
dataset so i assume that the exception about the relation
is generated by the database. I also manually set the key
value in the second table. Each table contains a single
row. I checked the values in both tables and there isn't a
null value anywhere.
a summary of my problem: Update method adds new row in the
database (as expected) but then raises an exception as if
it failed to update.
I have a form with binded controls. Most of them bind to a
main table and some of them bind to a secondary table.
These tables are related to each other (One to One
relation in the back end database) but this relation is
not implemented in any way on the dataset. I just use a
query to get the second table based on the key value of
the main table.
The possible scenarios when filling the dataset are:
Main Table | Second Table
Key Value | Related Key Value
======================================
Exists | Exists
Exists | Does not exist
Does not exist | Does not exist
When rows exist in both tables, updates works fine.
When row exists only in main table, i create a new row in
the second table and updates work fine
When none of the tables return a row i create a row in the
first table, update it (works fine) and then i create a
row in the second table and try to update it. An exception
is raised that key value cannot be null and that a key
value must exist in the related table (the fist table). I
check the database and row has been added in the table.
Why is the exception raised then???
There is no relation between the two tables within the
dataset so i assume that the exception about the relation
is generated by the database. I also manually set the key
value in the second table. Each table contains a single
row. I checked the values in both tables and there isn't a
null value anywhere.