Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two tables

Tabel1 ->(SR_NO,AH,Model,Price,Qty) SR_NO(PK)

Tabel2 -> (Id,Invoice_NO,SR_NO,Customer_Name,Company_Name,Model_Name,Qty,Price,Amount)
Invoice_NO and SR_NO(FK).

when I insert values in Tabel2
i get an error

The INSERT statement conflicted with the FOREIGN KEY constraint


what is the problem and how can it be solved.??

What I have tried:

I rebuild the relation.
I reenter the values
Posted
Updated 7-Nov-16 12:22pm
Comments
[no name] 7-Nov-16 16:23pm    
Look at your query and look at your constraint. Fix the conflict.
PIEBALDconsult 7-Nov-16 16:24pm    
Sure you INSERT into table 1 before table 2?

1 solution

The foreign key conflict is probably because the SR_NO you're trying to insert into table 2 does not exist in table 1.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900