Sometimes I get this errormessage when I am trying to save a page:
Violation of PRIMARY KEY constraint 'PK_tblWorkProperty'. Cannot insert duplicate key in object 'dbo.tblWorkProperty'.
The page is in a own pagetype with a own pagedefinitiontype and several predefine pagedefinitiontypes. I only get this error when there already is a version in the versionhistory that had not been published yet.
Here is the errorstack:
[SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_tblWorkProperty'. Cannot insert duplicate key in object 'dbo.tblWorkProperty'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +859322
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +736198
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1959
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +903
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
EPiServer.DataAccess.AbstractCommand.ExecuteNonQuery() +12
EPiServer.DataAccess.PageSaveDB.SavePageVersionProperty() +544
EPiServer.DataAccess.PageSaveDB.CreateAndSave(SaveAction action, String currentUser) +278
EPiServer.DataAccess.PageSaveDB.Save(PageData page, SaveAction action, String currentUser) +419
EPiServer.LocalPageStore.Save(PageData page, SaveAction action, AccessLevel access) +353
EPiServer.DataFactory.Save(PageData page, SaveAction action, AccessLevel access) +546
EPiServer.DataFactory.Save(PageData page, SaveAction action) +313
EPiServer.Web.PageExtensions.SaveCurrentPage.SavePage() +65
EPiServer.PageBase.SavePage() +157
EPiServer.UI.Edit.EditPanel.SavePage() +143
EPiServer.UI.Edit.EditPageButtonControl.Save(SaveAction saveAction, Boolean goToViewPage) +49
EPiServer.UI.Edit.EditPageButtonControl.Save_Click(Object sender, EventArgs e) +11
EPiServer.UI.WebControls.ToolButton.OnClick(EventArgs e) +101
EPiServer.UI.WebControls.ToolButton.RaisePostBackEvent(String eventArgument) +132
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Anyone have any idea why?