This project is read-only.

data access

Topics: Writing modules
Aug 2, 2011 at 9:55 PM

we have a problem with the dataaccess when we try to create a new entry we always get :

Cannot insert the value NULL into column 'Id', table 'orchard.dbo.SEN_TIME_TIMESRecord'; column does not allow nulls. INSERT fails.
The statement has been terminated.


what can be the reason?


thank you so much



Aug 2, 2011 at 9:56 PM

Your Id table probably wasn't properly declared in the migration.

Aug 3, 2011 at 5:53 AM
Edited Aug 3, 2011 at 6:41 AM

you were right!

now i dont get this anymore!

But if i create a new entry via IRepository the id in the model is autoincremented as it should, but it never reaches the database :(

no error and nothing.


is it possible that the transaction is completed as soon as the controller method is closed, for some reason now it works..

Aug 4, 2011 at 12:34 AM
Edited Aug 4, 2011 at 12:34 AM

Yes, there is an ambient implicit  transaction around everything you do in Orchard. It gets rolled back if there is an exception.