Sunday, September 6, 2009
Using VS2008 and Entity Framework, the exact error message is:
"The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.\r\nThe statement has been terminated."
There are several causes for this rather generic (and not very intuitive) error message.
I had changed some fields in the SQL 2008 database from non-nullable to nullable, and then asked the tool to “update model from database”. The error message appeared in that instance because one part of the ADO.NET Entity Data Model does not automatically get updated when this happens. The ADO.NET Entity Data Model has three parts:
SSDL (Store Schema Definition Language)
CSDL (Conceptual Schema Definition Language)
MSL (Mapping Schema Language)
So what is the [workaround]?
The SSDL and the MSL update just fine, but I had to “hand-code” the changes in the CSDL.
And Voila! Problem solved!
In Visual Studio 2008, I periodically see the error in the status bar:
”Error updating JScript Intellisense, see Error list”
HOWEVER, there are no errors about this in the Error list! And, the site compiles, runs, and publishes perfectly! Total annoyance!
I believe this is an error caused by the inclusion of the JQuery library and some inability of the Intellisense parser to “play nice in the playground”.
Okay, so what’s the [workaround]?
You can force an update of Intellisense with the following keyboard-shortcut:
Ctrl + Shift + J
And Voila! Problem Solved! Annoyance gone!
I am using VS2008 in a Vista Ultimate environment. Here is the complete error message:
”Exception Details: System.Web.HttpException: Session state can only be used when enableSessionState is set to true,
either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a
custom session state module is included in the “<configuration>\<system.web>\<httpModules> section in the application configuration.”
NONE of that was the problem! I even verified that SessionState was running as a service, which it was!
Okay, what is the [workaround]?
Control Panel > Programs > Turn Windows features on or off
When that dialog-box finishes loading, expand:
Internet Information Services > Web Management Tools > IIS 6.0 Management Compatibility
Make sure the following two check-boxes are checked:
IIS 6 WMI Compatibility
IIS Metabase and IIS 6 configuration compatibility
And Viola! Problem solved! That was a two-hour ordeal for our team! Hope I saved you some time!