insert error in sqlserver 2005 using with asp.net MVC 1.0?
how this error can be removed
The INSERT statement c开发者_运维知识库onflicted with the FOREIGN KEY constraint "FK_Address_ContactPerson". The conflict occurred in database "C:\USERS\SAHIL\DOCUMENTS\DOWNLOADS\COMPRESSED\N-LAYERDESIGN\N-LAYERDESIGN\APP_DATA\NLAYER.MDF", table "dbo.ContactPerson", column 'Id'.
pls help?
This error can be avoided by either respecting the foreign key constraint or removing this constraint in the database.
The ContactPersonId
in your Address
table doesn't have a matching record in your ContactPerson
table.
Make sure the ContactPerson
is added first.
From the name (FK_Address_ContactPerson) and error it seems like your contact doesn't have an address.
Are you trying to insert a contact where the there is an invalid value in the the address id on the contact, but where the corresponding Address doesn't exist?
精彩评论