public bool UpdateValues(String impR, String actR, String proR, String impV, String magV)
{
bool IsInserted = false;
try
{
MatrixValues c = cecbContext.MatrixValues.First(i => i.actv_reference == actR); // primary key
c = cecbContext.MatrixValues.First(i => i.impt_reference == impR); // primary key
c = cecbContext.MatrixValues.First(i => i.proj_reference == proR); // primary key
c.mtrxV_importance = double.Parse(impV); // updated value
c.mtrxV_magnitude = double.Parse(magV); // updated value
cecbContext.SaveChanges(); // getting an error here!!!
IsInserted = true;
}
catch (Exception)
{
IsInserted = false;
}
return IsInserted;
}
詳細を更新しようとするとエラーが発生する
エラーは
PRIMARY KEY 制約 'PK_MatrixValues' に違反しています。オブジェクト 'dbo.MatrixValues' に重複するキーを挿入できません。