Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/11/2011 2:27:33 PM
Gravatar
Total Posts 21

Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'

I'm trying to create a new product via the CMS. From store manager -> Product Administration -> New Product. After entering the product info and clicking save I got this error. I don't even see a checkbox for anything like IsDeleted. Any help is appreciated:

 

Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'; column does not allow nulls. INSERT fails.
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: Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'; column does not allow nulls. INSERT fails.
The statement has been terminated.

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): Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +404
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1363
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6387741
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +6389442
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +538
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +689
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +327
   mojoPortal.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, Int32 commandTimeout, SqlParameter[] commandParameters) +238
   mojoPortal.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) +20
   WebStore.Data.DBProduct.Add(Guid guid, Guid storeGuid, Guid taxClassGuid, String modelNumber, Byte status, Byte fullfillmentType, Decimal weight, Int32 quantityOnHand, String imageFileName, Byte[] imageFileBytes, DateTime created, Guid createdBy, DateTime lastModified, Guid lastModifedBy, String url, String name, String description, String teaser, Boolean showInProductList, Boolean enableRating, String metaDescription, String metaKeywords, Int32 sortRank1, Int32 sortRank2, String teaserFile, String teaserFileLink, String compiledMeta) +2928
   WebStore.Business.Product.Create() +1239
   WebStore.Business.Product.Save() +244
   WebStore.UI.AdminProductEditPage.Save() +2065
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707

11/11/2011 2:33:58 PM
Gravatar
Total Posts 18439

Re: Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'

In my database that column has a default value of 0 which prevents it being null on insert. Seems like your db is in a strange state, did you do something like importing tables? doing that loses all kinds of things like primary keys default values etc.

Hope that helps,

Joe

11/11/2011 3:36:40 PM
Gravatar
Total Posts 21

Re: Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'

Thanks Joe. I haven't done anything to the DB, which actually concerns me more. I just took over this site so I'm not sure what the original developers did!

I added the default value to that column and was able to add a product.

Thanks again!

 

11/11/2011 3:40:31 PM
Gravatar
Total Posts 21

Re: Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'

Just encountered the same problem - and solution - for the ws_Offer table.

11/12/2011 8:35:42 AM
Gravatar
Total Posts 18439

Re: Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'

My best guess is the previous developer initially used SQL CE which does not support WebStore then migrated to SQL server, but instead of scripting off the webstore tables (which would have been the correct way to do it) he imported them from another database and they lost some properties as a result. I would check if those tables even have the Guid columns as primary keys as they should.

Hope that helps,

Joe

11/14/2011 10:44:38 AM
Gravatar
Total Posts 21

Re: Cannot insert the value NULL into column 'IsDeleted', table 'CCG.dbo.ws_Product'

Well, thankfully the Guid columns are showing as PK's.

Thanks again

You must sign in to post in the forums. This thread is closed to new posts.