April 16, 2010 at 10:44 am
ERROR:The INSERT statement conflicted with the FOREIGN KEY constraint "fk". The conflict occurred in database "oee", table "dbo.tblproduct", column 'product_id'
--------------------------------------------------------------------------------------------
This Error Occured when I want to register some records in C# Application,
I mean in SQL Server 2005 it dosent have any problem for inserting records,
I have two table,one table is the main table(tblproduct) and the other(tblasset)that has a forein key from the main table.
--------------------------------------------------------------------------------------------
I'm sure that the connection string and the other things is correct because when I remove the foreinkey all the things work correct but with forien key this error raises.
Please Help Me.
April 16, 2010 at 12:43 pm
The data you are entering into asset table doesnt have the reference data of product id available in product table.
always check whether reference data is available in primary table(product) using if exist .
Regards
Durai Nagarajan
April 16, 2010 at 1:14 pm
if you write out the join in sql, you'll most likely see that your parent and child records don't match/or missing record(s)...hence your issue.
April 17, 2010 at 12:06 pm
thanks guyssss,
You konw I didnt pay attention in my C# code,The time that I Insert a record I saw that the foreinkey field didnt get value,it means that a " " value tried to insert so this error occurs.
Agin Thanks.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply