I am using a Database table whose structure is like this
RejectID int Primary Key
RecordingID nvarchar(500)
RejectedBy int
On one button click I am trying to add object like this:
public void btnReject_click()
{
RejectedRecording currentRR = new RejectedRecording();
currentRR.RecordingID = "hbi123kjubj27676";
currentRR.RejectedBy = 5;
objOmniPCXRecordEntities.RejectedRecordings.AddObject(currentRR);
}
on other button click I have called Save changes like:
public void btnSave_click()
{
objOmniPCXRecordEntities.SaveChanges();
}
It works fine if I only try to add one object but in case of second record exception occurs which is
Unable to determine the principal end of the 'OmniPCXRecordModel.FK_RejectedRecordings_RejectedRecordings' relationship. Multiple added entities may have the same primary key.