denisjoconnor
denisjoconnor

Reputation: 115

Kentico | Error on Upgrade - Conversion failed when converting from a character string to uniqueidentifier

After successfully upgrading from ver7 to ver8, can only see admin screens with actual site displaying below error:

Server Error in '/' Application.

Conversion failed when converting from a character string to uniqueidentifier.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting from a character string to uniqueidentifier.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +3189408
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +753
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +5042
System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows) +278 System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) +295
System.Data.SqlClient.SqlDataReader.Read() +42
System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) +157 System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +225
System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +479
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +277
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +178
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +122
CMS.DataEngine.AbstractDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +251

[Exception: [DataConnection.HandleError]:

Query: SELECT * FROM ( SELECT [PageID], [MenuItemName], [MenuItemTeaserImage], [Synopsis], [PermanentExhibition], [WheelchairAccessible], NULL AS [HomeID], NULL AS [MenuItemGroup], ClassName, DocumentCulture, DocumentGUID, DocumentModifiedWhen, DocumentMenuCaption, DocumentMenuClass, DocumentMenuClassHighLighted, DocumentMenuClassOver, DocumentShowInSiteMap, DocumentMenuItemHideInNavigation, DocumentMenuItemImage, DocumentMenuItemImageHighlighted, DocumentMenuItemImageOver, DocumentMenuItemInactive, DocumentMenuItemLeftImage, DocumentMenuItemLeftImageHighlighted, DocumentMenuItemLeftImageOver, DocumentMenuItemRightImage, DocumentMenuItemRightImageHighlighted, DocumentMenuItemRightImageOver, DocumentMenuJavascript, DocumentMenuRedirectUrl, DocumentMenuRedirectToFirstChild, DocumentMenuStyle, DocumentMenuStyleHighlighted, DocumentMenuStyleOver, DocumentName, DocumentUrlPath, NodeAliasPath, NodeID, NodeChildNodesCount, NodeClassID, NodeLevel, NodeLinkedNodeID, NodeParentID, SiteName, NodeACLID, NodeSiteID, NodeOwner, NodeOrder, NodeName, DocumentSitemapSettings, NodeOrder AS CMS_O1, ROW_NUMBER() OVER (ORDER BY DocumentName) AS CMS_SRN, 0 AS CMS_SN, 'cms.document.nmi.page' AS CMS_T FROM View_NMI_Page_Joined WHERE NodeSiteID = @NodeSiteID AND (DocumentMenuItemHideInNavigation = 0) AND (Published = @Published AND NodeLevel <= @NodeLevel AND DocumentCulture = @DocumentCulture) UNION ALL SELECT NULL AS [PageID], [MenuItemName], [MenuItemTeaserImage], NULL AS [Synopsis], NULL AS [PermanentExhibition], NULL AS [WheelchairAccessible], [HomeID], [MenuItemGroup], ClassName, DocumentCulture, DocumentGUID, DocumentModifiedWhen, DocumentMenuCaption, DocumentMenuClass, DocumentMenuClassHighLighted, DocumentMenuClassOver, DocumentShowInSiteMap, DocumentMenuItemHideInNavigation, DocumentMenuItemImage, DocumentMenuItemImageHighlighted, DocumentMenuItemImageOver, DocumentMenuItemInactive, DocumentMenuItemLeftImage, DocumentMenuItemLeftImageHighlighted, DocumentMenuItemLeftImageOver, DocumentMenuItemRightImage, DocumentMenuItemRightImageHighlighted, DocumentMenuItemRightImageOver, DocumentMenuJavascript, DocumentMenuRedirectUrl, DocumentMenuRedirectToFirstChild, DocumentMenuStyle, DocumentMenuStyleHighlighted, DocumentMenuStyleOver, DocumentName, DocumentUrlPath, NodeAliasPath, NodeID, NodeChildNodesCount, NodeClassID, NodeLevel, NodeLinkedNodeID, NodeParentID, SiteName, NodeACLID, NodeSiteID, NodeOwner, NodeOrder, NodeName, DocumentSitemapSettings, NodeOrder AS CMS_O1, ROW_NUMBER() OVER (ORDER BY DocumentName) AS CMS_SRN, 1 AS CMS_SN, 'cms.document.nmi.home' AS CMS_T FROM View_NMI_Home_Joined WHERE NodeSiteID = @NodeSiteID AND (DocumentMenuItemHideInNavigation = 0) AND (Published = @Published AND NodeLevel <= @NodeLevel AND DocumentCulture = @DocumentCulture) ) AS SubData ORDER BY CMS_O1, CMS_SRN, CMS_SN

Caused exception: Conversion failed when converting from a character string to uniqueidentifier. ]
CMS.DataEngine.AbstractDataConnection.HandleError(String queryText, Exception ex) +282
CMS.DataEngine.AbstractDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +342
CMS.DataEngine.GeneralConnection.RunQuery(QueryParameters query) +384 CMS.DataEngine.GeneralConnection.ExecuteQueryInternal(QueryParameters query) +458 CMS.DataEngine.DataQueryBase1.GetDataFromDB() +149
CMS.DataEngine.DataQueryBase
1.GetData() +120
CMS.DataEngine.DataQueryBase1.get_Result() +106
CMS.DocumentEngine.DocumentQueryProperties.FilterResultsByPermissions(IDataQuery query, Int32& totalRecords) +2128
CMS.DocumentEngine.MultiDocumentQueryBase
3.GetResults(IDataQuery query, Int32& totalRecords) +54
CMS.DataEngine.MultiQueryBase2.GetDataFromDB() +60
CMS.DataEngine.DataQueryBase
1.GetData() +120
CMS.DataEngine.DataQueryBase`1.get_Result() +106
CMS.Controls.CMSAbstractMenuProperties.GetMenuItems(String resolvedPath, Boolean siteMap) +910
CMS.Controls.CMSAbstractMenuProperties.GetDataSource(Boolean siteMap) +839 CMS.Controls.CMSListMenu.ReloadData(Boolean forceLoad) +202 CMS.Controls.CMSListMenu.InitControl(Boolean loadPhase) +162
CMS.Controls.CMSListMenu.OnLoad(EventArgs e) +500
System.Web.UI.Control.LoadRecursive() +68
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3811

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2106.0

I compared what I thought was the table giving the error with the Document Types cms.document.nmi.home which inherits from cms.document.nmi.page and the conflicting data type 'MenuItemTeaserImage' and saw the following:

enter image description here

And the field type for the same data type in kentico admin is as follows:

https://snag.gy/ULS5Iz.jpg

How do I go about remedying this error? Thx

Upvotes: 0

Views: 406

Answers (3)

mnield
mnield

Reputation: 1869

My guess is that the cause may have been a change in the Page (menu item) page type. You're inheriting from this in you NMI_Page and perhaps the upgrade SQL did not deal with this effectively. What you've done above clearly worked, but I'm curious if you could have broken the inheritance and fixed your teaser field?

Upvotes: 0

denisjoconnor
denisjoconnor

Reputation: 115

The problem was caused by a custom page type NMI_Page, which had a MenuItemTeaserImage column. This column has exactly the same name as the MenuItemTeaserImage column in a different page type, but different type, which causes a conflict.

Using same field names in different page types is not recommended, so I used the page type name as a prefix for the field names.

I renamed the MenuItemTeaserImage field in the NMI_Page document type to NMI_PageMenuItemTeaserImage (and changed this name in all the transformations too).

Upvotes: 1

DTK
DTK

Reputation: 470

Have you've made sure you've run the SQL scripts after the code upgrade (If you've done the upgrade manually)?

https://docs.kentico.com/k8/installation/upgrading-kentico-7-to-8/upgrading-kentico-manually

  • Open the upgrade_8_0.sql script from the SQL directory in the upgrade installation folder.

Have you upgraded directly to Kentico 8.2? or is this the 8.0 version? If you do have you made sure the Site started between every upgrade? This will make sure all the DB updages are processed

Upvotes: 1

Related Questions