Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows Application
Hi,
I have one windows application and one web application through windows application inserting a quickbooks records to tables with the help of web application.
 
While running the application it is working fine and it strong the values into table but i created a setup for that windows application ,while running setup it is not storing the values in to table only one table values it storing, after that it will some exception like .
The INSERT statement conflicted with the FOREIGN KEY constraint "FK__CustomerP__Class__618671AF". The conflict occurred in database "FISOFTSP", table "dbo.CustomerPortal_ClassCode", column 'ClassID'.
 
what is the pls help me for this one ..
Advance thanks.
Posted 6-Sep-12 21:39pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You are inserting wrong data.If the primary key column doesn't have this data , it is not going to accept it from insert statement. If you have SQL Server Management Studio, open it up and use sp_help to see which column that FK is on, and which column of which other table it references.
 
Also have a look on this..
http://social.msdn.microsoft.com/forums/en-US/transactsql/thread/0ba0501d-bc2e-4afc-824e-b75f18a8b491/[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hello,
The error is pretty clear.
 
ClassID is in a foreign key relationship with another table, which does not contain the ID you are trying to insert. Insert the value in the dbo.CustomerPortal_ClassCode master table first, or check and correct the value you are inserting in ClassID in child table
 
Thanks!!!!!!!!!
  Permalink  

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

  Print Answers RSS
0 Marcin Kozub 310
1 OriginalGriff 248
2 Sergey Alexandrovich Kryukov 215
3 Richard MacCutchan 202
4 Praneet Nadkar 197
0 OriginalGriff 8,048
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 7 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100