Error Trying to Move Category to Subcategory in Gold

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
euroluxantiques
Commander (CMDR)
Commander (CMDR)
Posts: 118
Joined: Sat Dec 20, 2008 11:27 pm

Error Trying to Move Category to Subcategory in Gold

Post by euroluxantiques » Mon Dec 17, 2012 7:09 pm

I ported my database from a AC 7.07 database and did the new install with Gold R3 and all the database changes went well. As part of our store upgrade, we're adding a lot of new product lines and are making some changes to the category structure. We had '0' level categories for French Antique Furniture, Chinese Antiques Furniture, and Reproduction Furniture. I set up a new category called 'Furniture' at the main level. I then selected the 3 original furniture categories, and selected move, and chose to move them under the new 'Furniture' categories as subcategories. I get a primary key violation in ac_CategoryParents. I find this strange, as everything has been done directly in admin and is not a result of me monkeying around directly in the database. Any ideas why this is not working? Are there work arounds. I have lots of subcategories and products set up under these 3 existing categories, so I don't want to drop them and recreate them. The error I got when I tried the move is:

Code: Select all

Server Error in '/' Application.
Violation of PRIMARY KEY constraint 'ac_CategoryParents_PK'. Cannot insert duplicate key in object 'dbo.ac_CategoryParents'.
The statement has been terminated.
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: Violation of PRIMARY KEY constraint 'ac_CategoryParents_PK'. Cannot insert duplicate key in object 'dbo.ac_CategoryParents'.
The statement has been terminated.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[SqlException (0x80131904): Violation of PRIMARY KEY constraint 'ac_CategoryParents_PK'. Cannot insert duplicate key in object 'dbo.ac_CategoryParents'.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
   System.Data.SqlClient.SqlDataReader.get_MetaData() +86
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +311
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() +12
   NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) +292
   NHibernate.Id.InsertSelectDelegate.ExecuteAndExtract(IDbCommand insert, ISessionImplementor session) +52
   NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder) +83

[GenericADOException: could not insert: [CommerceBuilder.Catalog.CategoryParent][SQL: INSERT INTO ac_CategoryParents (CategoryId, ParentId, ParentLevel, ParentNumber) VALUES (?, ?, ?, ?); select SCOPE_IDENTITY()]]
   CommerceBuilder.DomainModel.EntityWithTypedId`1.Save() +128
   AbleCommerce.Admin.Catalog.MoveCatalogObjects.SaveButton_Click(Object sender, EventArgs e) +186
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


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

Post Reply