Could not save post: Cannot insert the value NULL into column 'PostCategoryID'

Topics: ASP.NET 2.0, Business Logic Layer
Apr 17, 2012 at 8:23 PM

Hello,

I get the following error when attempting to save a post that is assigned to a category (I am able to save the post if there are no categories selected).

Could not save post: Cannot insert the value NULL into column 'PostCategoryID', table 'BlogEngine.dbo.be_PostCategory'; column does not allow nulls. INSERT fails. The statement has been terminated.

I should let you know that this database is an upgrade from 1.6 to 2.5. I have used the three upgrade scripts that were included in './setup' in series; there were errors in the final script ''MSSQLUpgradeFrom2.0to2.5.sql' (I shall post these errors if they would help this problem.)

Is there anything I can do to solve / debug this problem?

Apr 18, 2012 at 4:51 PM

I'd be most grateful for any suggestions with this.

Coordinator
Apr 18, 2012 at 8:44 PM

Did you verify actual data in the tables? What is your categories table data looks like? There is BlogID field that must match with BlogID field in the blogs table. If you had errors during upgrade, it could be that your IDs got out of sync.

Apr 19, 2012 at 1:23 PM
Edited Apr 19, 2012 at 1:27 PM

Thanks for the reply.

 

[SOLUTION]

I didn't get any errors when I ran the upgrade script on my actual database (rather than a copy).