This project is read-only.

Commonpart SqlDateTime overflow error

Topics: General, Troubleshooting, Writing modules
Sep 25, 2011 at 2:54 PM

Currently i'm getting athe following error when i use the commonpart on a type

{"SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."}

When i remove the commonpart from the type the error is gone. Somebody got a solution. I don't have custom datetime properties defined.

Sep 25, 2011 at 7:02 PM

The common part is used absolutely everywhere, so it has to be something different on your site.

Sep 26, 2011 at 6:02 PM

Yes it's really used everywhere and had no problems with other sites. but the problem only occurs when i add the commonpart. when i remove the part the problem is gone.

Maybe it has something to do with my database culture settings?

Sep 26, 2011 at 9:16 PM

Possibly yes.

Sep 28, 2011 at 10:11 AM
Edited Sep 28, 2011 at 10:13 AM

I spended a lot of time on this on but unfortunately i didn't resoled it yet. I'm almost sure it is an Orchard bug because it doesn't have anything to do with my custom parts or types because when i remove the commonpart the errors are gone.

Does anybody got some ideas for this problem? Maybe it has something to do with lists? because i have to problem in a list. Also i don't use datetime properties in my parts.

Sep 28, 2011 at 5:52 PM

CommonPart does assign datetimes dynamically, so there might be an issue here in regard to current culture on the server side. Can you file a bug, with some repro, and the server culture you are using ?

Sep 29, 2011 at 8:00 PM

Ok guys i found out the problem:

When a part is later added (when there's already created content for this type) to a contentType with a datetime part and is not null the error can occur. This because it tries to read the database part record but this results in an empty datetime collumn and raises the error.


I've added a datetime column/property to a new part and added the part to a user. Because i haven't saved the user yet (and so not create a record for the custom part) the error will be raised when i view a page because the current user is always read is suppose(?).

A default value doesn't do anything because the row isn't created yet. Offcourse i can make the datetime nullable but that's not what i want. it all sounds logical but it's afterwards but still it is annoying if you want to make a property not nullable.

Thanks for your support btw! Keep up the good work!

Sep 29, 2011 at 8:32 PM

Interesting. Can you please file a bug for that?