Sql: how to Insert data in table when Foreign Key is not a primary key

0 votes
asked Mar 13, 2016 by bolla_2270 (540 points)
I created Model with Entity Framework Code First and have two classesProduct.

3 Answers

0 votes
answered Mar 15, 2016 by sterner (1,180 points) 1 flag

Primary keys are marked in bold, and foreign keys are marked in italics.
The foreign key in the Invoices table points to that primary key. Then, the 'supplier number' is the primary key in the Supplier table.
0 votes
answered Apr 14, 2016 by ArkNext (300 points)
I think you should try this code because i have used it and it will work
Check out the recently published The INSERT statement conflicted with the FOREIGN KEY ...
commented Apr 14, 2016 by Hochstedle (480 points)
You can make this a lot easier by extending your arrays with a count function. It can be found in detail in here
commented Apr 15, 2016 by Doing_Doing (120 points)
This really useful example
0 votes
answered May 7, 2016 by Thanks (480 points)
When answering a question please:Read the question carefully

What is Geekub?

Q&A site for professional and enthusiast programmers, software developers and other technical users. With your help, we hope to work together to build a library of detailed answers to just about any question that is related to programming!