Cannot Insert NULL into column 'UserId'

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Cannot Insert NULL into column 'UserId'

Post by keats76 » Fri Sep 04, 2009 2:38 pm

Anyone ever see this? I'm upgrading an older Pre 7 release to 7.0.3. I've tried a few different methods of upgrading, and I'm pulling my hair out at the moment :). I brought up a fully working 7.0.3 instance (demo) and then I started to migrate data over. This error started happening after I moved over the user data. I made sure that all of the table indicies etc were intact. Thoughts?

Thanks,
Mike

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Cannot Insert NULL into column 'UserId'

Post by keats76 » Fri Sep 04, 2009 2:39 pm

Oops, would help if I posted the full message:

Cannot insert the value NULL into column 'UserId', table 'AC.dbo.ac_Users'; 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 'UserId', table 'AC.dbo.ac_Users'; 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 'UserId', table 'AC.dbo.ac_Users'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +83
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
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.ExecuteScalar() +139
Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteScalar(DbCommand command) +178
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteScalar(DbCommand command) +68
CommerceBuilder.Data.Database.ExecuteScalar(DbCommand command) +233
CommerceBuilder.Users.User.BaseSave() +2711
CommerceBuilder.Users.User.Save() +1166
CommerceBuilder.Users.UserDataSource.a(String A_0) +499
CommerceBuilder.Users.UserDataSource.LoadForUserName(String userName, Boolean createMissing) +191
CommerceBuilder.Common.Token.InitUserContext(HttpContext context) +630
CommerceBuilder.Services.c.b(Object A_0, EventArgs A_1) +74
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Cannot Insert NULL into column 'UserId'

Post by keats76 » Fri Sep 04, 2009 2:40 pm

The error happens whenever I try to load a page in AC, doesn't matter which page.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Cannot Insert NULL into column 'UserId'

Post by jmestep » Fri Sep 04, 2009 3:10 pm

How did you move the data over? The best way in an older version of Able 7 has been to install the page files for a newer version and then run the upgrade script in the install folder to upgrade the database. I tried data from one version of the dataport into another in the newer build because we didn't have access to the database to download it and it was really a mess. So we've done the upgrade route via a script in the install folder twice and it has worked out fine.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Cannot Insert NULL into column 'UserId'

Post by keats76 » Mon Sep 07, 2009 6:22 am

Hmmm, yeah I've tried a number of different methods (data migration tool) for the appropriate versions as well as a manual database migration. Both resulted in the same problem. The problem with the page file update is that there are a number of steps between pre 7 to 7.0.3. I have hundreds of customizations (most of which are in the conlib/custom directory, but many of which were admin updates and are made to core files). I've updated the appropriate classes to jive with 7.0.3, but not with each flavor in between.

I'd rather not have to do a file compare and custom merge for each version of the upgrade. It's been painful enough as is. I had the 7.0.3 instance running fine until I did the user migration. Hopefully, I can figure out what's going on, and just address it from this angle? I guess the best way to track down the problem would be to look at the DB logs? Guess I'll need to get a higher level of rights on my SQL Server box.

Any other thoughts?

Thanks!
Mike

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Cannot Insert NULL into column 'UserId'

Post by keats76 » Tue Sep 08, 2009 6:14 am

Nevermind, as is usually the case with this type of problem, the issue was behind the keyboard, not with AC.

I removed the identity portion of the index on the ac_users table to copy over my user list. I subsequently forgot to re-enable the identity specification (and bump up the seed). Once complete, everything was fine.

Thanks!
Mike

Post Reply