Is it any examples about inputting the data to the table with the constraint?

D

deLOL

I would like to know that how can I input the data to the table with the
relationship constraint?
I got a problem that I want to write in some data to the table, firstly I
would "DROP" the constraint, then using the db.execute "INSERT INTO...",
then "ADD CONSTRAINT...".
However, It prompted me a error message that the main table doesn't have the
record related to the input one.
So what is the problem?
 
E

Emilia Maxim

---------- "deLOL said:
I would like to know that how can I input the data to the table with the
relationship constraint?
I got a problem that I want to write in some data to the table, firstly I
would "DROP" the constraint, then using the db.execute "INSERT INTO...",
then "ADD CONSTRAINT...".
However, It prompted me a error message that the main table doesn't have the
record related to the input one.
So what is the problem?

The error message tells you exactly what the problem is. If you need
the relationship, then you have to take care to first create a record
in the main table, grab its primary key, and only then append the
records in the child table. If you need help, please give more details
as to what are you trying to achieve.

Deleting the relationship just for an INSERT statement 1) would turn
the relationship totally absurd (what's the sense of creating a
relationship and then forcing in data not respecting it), 2) won't
work. When creating it again, Jet would come up with a similar error
("Data in the table does not fit the relational integrity...") and
refuse to create it.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top