Click here to Skip to main content
15,900,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
created a form with a record control and table control my record control as
2 drop down list project name and package numbers.
table control text boxes: store, location, contact, item, qty,

database tables:
projects table:
project_ID Pk int Identity
Client Name
project name


Package table:
package_ID PK int Identity
project_ID fk
Package Numbers
Package Name

Store table
Store_ID Pk int Identity
package_ID fk
Store Name
Location
Contract
items
qty



My problem is that when I go to save I get a error insert statement conflict with the foreign key constraint "".
it's trying to insert a
Posted

You are most likely not supplying a necessary foreign key but without showing how you are inserting the records we can't help you.
 
Share this answer
 
You are violating SQL rules on a foreign key constraint. The problem is you are trying to insert a row into a table that required a foreign key to be supplied by a parent table.

For the tables you have given, you have to insert to the tables in the following order:

1. Projects
2. Package
3. Store

Check the insert statement order

Dave
 
Share this answer
 
Comments
postonoh 10-Oct-10 21:02pm    
Can you give me a insert query example
DavidKiryazi 10-Oct-10 22:35pm    
Depends how you are approaching the problem. Are you using stored procedures, data sets? and what version of C# are you using? This problem gets easier to solve in version 4.0.

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