Forums - C# Corner

Forum guidelines
David Smith

David Smith

  • 0
  • 1.9k
  • 0

Primary Key Violation

Oct 11 2017 3:39 PM
I cannot insert record because of primary violation, which is find. However I want to update record if the primary or record is duplicate. So how to check if record is duplicate with this table having 4 primary keys? Can someone assist me on how to tackle this. There are four fields that are primary keys in this table.
 
The goal is to update record is exist, add record if it doesn't exist. Primary keys are mary below.
 
this.data.Color.Objects.Add(
new ControlObject()
{
COLOR_ID= colorId, //primary key
COLOR_OBJNAM = colorName, //primary key
COLOR_Key = colorKey, //primary key
COLOR_REVISION = colorRevision, //primary key
Value = value
}
);

Answers (4)