Error is occurring after first data enter.
Posted: Sun 10 Nov 2013 21:57
Hi I made a simple database trough devart entity developer and generate model in Visual studio. I wanted to have a test simple query, I added a controller to my model(MVC controller write/delete with entity framework). My first attempt to create a new row to database worked fine but error is occurring from the second data entering(DbUpdateException). And also delete does not work for the existing data.
Line 108: Organisation organisation = db.Organisations.Find(id);
Line 109: db.Organisations.Remove(organisation);
Line 110: db.SaveChanges();
Line 111: return RedirectToAction("Index");
Devart.Data.PostgreSql.PgSqlException: duplicate key value violates unique constraint
Error is occurring at line 110. Please help me.
Line 108: Organisation organisation = db.Organisations.Find(id);
Line 109: db.Organisations.Remove(organisation);
Line 110: db.SaveChanges();
Line 111: return RedirectToAction("Index");
Devart.Data.PostgreSql.PgSqlException: duplicate key value violates unique constraint
Error is occurring at line 110. Please help me.