Can't add content after import new site

Witchayanin Maythangkul asked on November 7, 2014 13:14

I'm have import site and it can not add content(document type).

An error occurred when saving data. Please see event log for more details. Message:

INSERT INTO CMS_Document ([DocumentName], [DocumentNamePath], [DocumentModifiedWhen], [DocumentModifiedByUserID], [DocumentForeignKeyValue], [DocumentCreatedByUserID], [DocumentCreatedWhen], [DocumentCheckedOutByUserID], [DocumentCheckedOutWhen], [DocumentCheckedOutVersionHistoryID], [DocumentPublishedVersionHistoryID], [DocumentWorkflowStepID], [DocumentPublishFrom], [DocumentPublishTo], [DocumentUrlPath], [DocumentCulture], [DocumentNodeID], [DocumentPageTitle], [DocumentPageKeyWords], [DocumentPageDescription], [DocumentShowInSiteMap], [DocumentMenuItemHideInNavigation], [DocumentMenuCaption], [DocumentMenuStyle], [DocumentMenuItemImage], [DocumentMenuItemLeftImage], [DocumentMenuItemRightImage], [DocumentPageTemplateID], [DocumentMenuJavascript], [DocumentMenuRedirectUrl], [DocumentUseNamePathForUrlPath], [DocumentStylesheetID], [DocumentContent], [DocumentMenuClass], [DocumentMenuStyleOver], [DocumentMenuClassOver], [DocumentMenuItemImageOver], [DocumentMenuItemLeftImageOver], [DocumentMenuItemRightImageOver], [DocumentMenuStyleHighlighted], [DocumentMenuClassHighlighted], [DocumentMenuItemImageHighlighted], [DocumentMenuItemLeftImageHighlighted], [DocumentMenuItemRightImageHighlighted], [DocumentMenuItemInactive], [DocumentCustomData], [DocumentExtensions], [DocumentCampaign], [DocumentTags], [DocumentTagGroupID], [DocumentWildcardRule], [DocumentWebParts], [DocumentRatingValue], [DocumentRatings], [DocumentPriority], [DocumentType], [DocumentLastPublished], [DocumentUseCustomExtensions], [DocumentGroupWebParts], [DocumentCheckedOutAutomatically], [DocumentTrackConversionName], [DocumentConversionValue], [DocumentSearchExcluded], [DocumentLastVersionName], [DocumentLastVersionNumber], [DocumentIsArchived], [DocumentLastVersionType], [DocumentLastVersionMenuRedirectUrl], [DocumentHash], [DocumentLogVisitActivity], [DocumentGUID], [DocumentWorkflowCycleGUID], [DocumentSitemapSettings], [DocumentIsWaitingForTranslation], [DocumentSKUName], [DocumentSKUDescription], [DocumentSKUShortDescription], [DocumentWorkflowActionStatus], [DocumentMenuRedirectToFirstChild] ) VALUES ( @DocumentName, @DocumentNamePath, @DocumentModifiedWhen, @DocumentModifiedByUserID, @DocumentForeignKeyValue, @DocumentCreatedByUserID, @DocumentCreatedWhen, @DocumentCheckedOutByUserID, @DocumentCheckedOutWhen, @DocumentCheckedOutVersionHistoryID, @DocumentPublishedVersionHistoryID, @DocumentWorkflowStepID, @DocumentPublishFrom, @DocumentPublishTo, @DocumentUrlPath, @DocumentCulture, @DocumentNodeID, @DocumentPageTitle, @DocumentPageKeyWords, @DocumentPageDescription, @DocumentShowInSiteMap, @DocumentMenuItemHideInNavigation, @DocumentMenuCaption, @DocumentMenuStyle, @DocumentMenuItemImage, @DocumentMenuItemLeftImage, @DocumentMenuItemRightImage, @DocumentPageTemplateID, @DocumentMenuJavascript, @DocumentMenuRedirectUrl, @DocumentUseNamePathForUrlPath, @DocumentStylesheetID, @DocumentContent, @DocumentMenuClass, @DocumentMenuStyleOver, @DocumentMenuClassOver, @DocumentMenuItemImageOver, @DocumentMenuItemLeftImageOver, @DocumentMenuItemRightImageOver, @DocumentMenuStyleHighlighted, @DocumentMenuClassHighlighted, @DocumentMenuItemImageHighlighted, @DocumentMenuItemLeftImageHighlighted, @DocumentMenuItemRightImageHighlighted, @DocumentMenuItemInactive, @DocumentCustomData, @DocumentExtensions, @DocumentCampaign, @DocumentTags, @DocumentTagGroupID, @DocumentWildcardRule, @DocumentWebParts, @DocumentRatingValue, @DocumentRatings, @DocumentPriority, @DocumentType, @DocumentLastPublished, @DocumentUseCustomExtensions, @DocumentGroupWebParts, @DocumentCheckedOutAutomatically, @DocumentTrackConversionName, @DocumentConversionValue, @DocumentSearchExcluded, @DocumentLastVersionName, @DocumentLastVersionNumber, @DocumentIsArchived, @DocumentLastVersionType, @DocumentLastVersionMenuRedirectUrl, @DocumentHash, @DocumentLogVisitActivity, @DocumentGUID, @DocumentWorkflowCycleGUID, @DocumentSitemapSettings, @DocumentIsWaitingForTranslation, @DocumentSKUName, @DocumentSKUDescription, @DocumentSKUShortDescription, @DocumentWorkflowActionStatus, @DocumentMenuRedirectToFirstChild); SELECT SCOPE_IDENTITY() AS [DocumentID]

Caused exception: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMS_Document_DocumentPageTemplateID_CMS_Template". The conflict occurred in database "KEN8_SCG", table "dbo.CMS_PageTemplate", column 'PageTemplateID'. The statement has been terminated.

Exception type: System.Exception Stack Trace: at CMS.DataEngine.AbstractDataConnection.HandleError(String queryText, Exception ex) at CMS.DataEngine.AbstractDataConnection.ExecuteScalar(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) at CMS.DataEngine.GeneralConnection.ExecuteScalar(QueryParameters query) at CMS.DataEngine.SimpleDataClass.Insert(Boolean getId) at CMS.DataEngine.AbstractInfo1.InsertData() at CMS.DocumentEngine.TreeNode.InsertCultureData() at CMS.DocumentEngine.TreeNode.InsertInternal(TreeNode parent) at CMS.DocumentEngine.TreeNode.Insert(TreeNode parent, Boolean useDocumentHelper) at CMS.DocumentEngine.DocumentHelper.InsertDocument(TreeNode node, TreeNode parentNode, TreeProvider tree, Boolean allowCheckOut) at CMS.FormControls.CMSForm.SaveDataInternal() at CMS.FormControls.BasicForm.SaveData(String redirectUrlAfterSave, Boolean showChangesSaved) at CMS.FormControls.CMSForm.DocumentManager_OnSaveData(Object sender, DocumentManagerEventArgs e) at CMS.FormControls.CMSAbstractManager2.RaiseSaveData(EventArgsType args) at CMS.FormControls.CMSDocumentManager.SaveDocumentInternal(String actionContext)

Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMS_Document_DocumentPageTemplateID_CMS_Template". The conflict occurred in database "KEN8_SCG", table "dbo.CMS_PageTemplate", column 'PageTemplateID'. The statement has been terminated.

Exception type: System.Data.SqlClient.SqlException Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteScalar() at CMS.DataEngine.AbstractDataConnection.ExecuteScalar(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction)

Correct Answer

Charles Matvchuk answered on November 7, 2014 15:46

Also it will accept a null value, I believe.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Charles Matvchuk answered on November 7, 2014 15:41

Your problem is here, unless I am missing something. Please make sure the PageTemplateID exists and is being used in the Documents Table.

Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMS_Document_DocumentPageTemplateID_CMS_Template". The conflict occurred in database "KEN8_SCG", table "dbo.CMS_PageTemplate", column 'PageTemplateID'. The statement has been terminated

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.