I have two tables namely transaction and checks tables
in transaction table I have columns named [transID], [PayToOrder], [BankCode], [Checknumber].
in checks table I have columns named [checknumber], [dateissued], [amount], [transID].
I am using a form as an entry.
here is the block of code that I used to insert data in the database.
"Insert on table 'TRANSACTIONS' caused a violation of Foreign Key constraint 'CHECKNUMBER' for key (inputted data).
please if anyone can enlighten me on this part
thanks
Rommel Ando
Решение
You are trying to insert data into the table TRANSACTIONS with a CHECKNUMBER that does not exist in the table CHECKS.
So if you have the relation you have above, you will not be able to insert this data in this fashion as the transID and Checknumber are the same for both.
You can either remove one of the foreign keys or you could set the checknumber to NULL for the insert of the transaction, insert the checks, then update the transaction check number to what is should be