Developer forum

Forum » Ecommerce - Standard features » Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.

David Alexandersson
Reply

I cant add new products! When i add a product and click Save (or Save and Close) i get this message:

 

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.

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.InvalidOperationException: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.

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: 
 

[InvalidOperationException: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.]
   System.Data.Common.DbCommandBuilder.BuildWhereClause(DataTableMapping mappings, DataRow dataRow, StringBuilder builder, DbCommand command, Int32 parameterCount, Boolean isUpdate) +1688159
   System.Data.Common.DbCommandBuilder.BuildUpdateCommand(DataTableMapping mappings, DataRow dataRow) +916
   System.Data.Common.DbCommandBuilder.GetUpdateCommand(DataRow dataRow, Boolean useColumnsForParameterNames) +57
   Dynamicweb.Data.Database.CreatePreparedAdapter(DbCommandBuilder& commandBuilder, IDbCommand command, Boolean tryFillIdentity) +192
   Dynamicweb.Ecommerce.Common.Number.Save() +160
   Dynamicweb.Ecommerce.Common.Number.NewNumber() +359
   Dynamicweb.Ecommerce.Common.NumberGenerator.GetNumber(String type) +141
   Dynamicweb.Ecommerce.Products.ProductRepository.Save(Product& product, String productId, String productVariantId, String productLanguageId) +909
   Dynamicweb.Ecommerce.Products.ProductService.SaveAndConfirmInternal(Product product, String productId, String productVariantId, String productLanguageId, Boolean skipExtendedSave, Dictionary`2 categoryFieldSortings) +235
   Dynamicweb.Ecommerce.Products.ProductService.SaveAndConfirm(Product product, String productId, String productVariantId, String productLanguageId, Boolean skipExtendedSave) +125
   Dynamicweb.Admin.eComBackend.ProductEdit.SaveProduct(Product product, String prodId, String groupId, String variantId, Boolean VariantProduct, Boolean wizardProduct, String redirUrl, Boolean closeAfterSave) +3594
   Dynamicweb.Admin.eComBackend.ProductEdit.SaveProduct_Click(Object sender, EventArgs e) +204
   Dynamicweb.Controls.RibbonBarButton.RaisePostBackEvent(String eventArgument) +46
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1665

 


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

 

 

I dont understand the error, since i send in Name and Number of the new product. I also get this error when i try to change a product (but then the changes come through even though i get the error), and also when i try to create a new shop..  What could it be?

 

 


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi David,

Check your database and make sure that NumberId is set as the primary key on the EcomNumbers table.

If the primary key is missing you should probably try to find out why, since other constraints might be missing as well.

/Morten

 
David Alexandersson
Reply

Thank you Morten!

It seems you're right. There seems to not be any primary key in EcomNumbers (see attachment). What could have caused this, and is there any way to resolve it? Im a novice in databases and I only use standard functionality in DW.

PK.JPG
 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

If it is a very old solution then it might be caused by an incomplete upgrade at some point. Otherwise, I have no idea what could have caused this.
Does the other Ecom* tables have primary keys? EcomProducts, EcomGroups, etc.

You can add the primary key manually:

  • Right click on the "EcomNumbers" table, select "Design".
  • Right click on the "NumberId" column, select "Set Primary Key"
  • Save changes

 

 

You must be logged in to post in the forum