我使用的是城堡的ActiveRecord項目和SQLServer 2008SQLDATETIME溢出 - 城堡項目的ActiveRecord和SQLServer 2008
我想這樣做:
ActiveRecordMediator<Question>.FindAll();
,但我得到這個錯誤:
SQLDATETIME溢出。必須介於1/1/1753 12:00:00 AM和12/31/9999 11:59:59 PM之間。
我使用日期時間類型的SQLSERVER 2008
我也試圖與DATETIME2,但得到了同樣的錯誤。
THX
更新:
堆棧跟蹤:
[SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.]
System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value) +4838155
System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value) +200
System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb) +46
System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj) +4843589
System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc) +4291
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.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +175
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd) +303
NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation) +65
NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) +1895
NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) +307
NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session) +1029
NHibernate.Action.EntityUpdateAction.Execute() +740
NHibernate.Engine.ActionQueue.Execute(IExecutable executable) +187
NHibernate.Engine.ActionQueue.ExecuteActions(IList list) +125
NHibernate.Engine.ActionQueue.ExecuteActions() +50
NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) +162
NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event) +102
NHibernate.Impl.SessionImpl.Flush() +297
Castle.ActiveRecord.Framework.SessionFactoryHolder.ReleaseSession(ISession session) in c:\daten\dev\External\Castle\AR2.0\ActiveRecord\Castle.ActiveRecord\Framework\SessionFactoryHolder.cs:257
Castle.ActiveRecord.ActiveRecordBase.FindAll(Type targetType, Order[] orders, ICriterion[] criteria) in c:\daten\dev\External\Castle\AR2.0\ActiveRecord\Castle.ActiveRecord\Framework\ActiveRecordBase.cs:1026
Castle.ActiveRecord.ActiveRecordMediator.FindAll(Type targetType, Order[] orders, ICriterion[] criterias) in c:\daten\dev\External\Castle\AR2.0\ActiveRecord\Castle.ActiveRecord\Framework\ActiveRecordMediator.cs:193
Castle.ActiveRecord.ActiveRecordMediator.FindAll(Type targetType) in c:\daten\dev\External\Castle\AR2.0\ActiveRecord\Castle.ActiveRecord\Framework\ActiveRecordMediator.cs:180
Castle.ActiveRecord.ActiveRecordMediator`1.FindAll() in c:\daten\dev\External\Castle\AR2.0\ActiveRecord\Castle.ActiveRecord\Framework\ActiveRecordMediator.Generic.cs:153
StackUnderflow.Persistence.Repositories.QuestionsRepository.GetNewestQuestions(Int32 numberOfQuestions) in C:\Users\Anas\Documents\Visual Studio 2010\Projects\StackUnderflow\StackUnderflow.Persistence\Repositories\QuestionsRepository.cs:24
StackUnderflow.Persistence.RichRepositories.RichQuestionRepository.GetNewestQuestions(Int32 numberOfQuestions) in C:\Users\Anas\Documents\Visual Studio 2010\Projects\StackUnderflow\StackUnderflow.Persistence\RichRepositories\RichQuestionRepository.cs:47
StackUnderflow.Web.Ui.Controllers.HomeController.Index() in C:\Users\Anas\Documents\Visual Studio 2010\Projects\StackUnderflow\StackUnderflow.Web.Ui\Controllers\HomeController.cs:21
lambda_method(ExecutionScope , ControllerBase , Object[]) +74
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +52
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +254
System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +192
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +314
System.Web.Mvc.Controller.ExecuteCore() +105
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +39
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +34
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +59
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8682542
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
明顯的問題 - 你的任何記錄是否包含可疑日期? – 2011-05-14 21:22:26
我在這個日期的數據庫中有一條記錄:01/01/2011 00:00:00 – Anas 2011-05-14 21:24:43
如果您設置VS.Net停止異常,您是否能夠獲得有關發生這種情況的更多信息代碼? – 2011-05-14 21:26:15