Quote:
"The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Approval_ApproveType". The conflict occurred in database "DMSFYPP", table "dbo.ApproveType", column 'ApproveID'. The statement has been terminated"
Let me explain the issue.
There are two tables.
There is a Relationship between them named as "
FK_Approval_ApproveType
".
When you write the following code...
Insert into Approval(UserID, DocID, ApproveID)
VALUES(@UserID, @DocID, @ApproveID)
the value of
@ApproveID
should be present in Table
ApproveType
.
That means a record for the
@ApproveID
should exist in the table.
For example if you are inserting row for
ApproveID
- 3, then there should be a Record existing for that ID in
ApprovalType
Table.
You can know what is the Approval Type you are sending by putting a Break Point inside the function and checking the
ApproveID
.