Currently got quite a few required date fields in the database that are working fine. However, I've had to add 5 optional date fields that are set as allow nulls.
If I set the Date field to Date.MinValue I get:
DotNetNuke.Services.Exceptions.ModuleLoadException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. ---> System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value) at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value) at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value) at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb) at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, String spName, Object[] parameterValues) at TIOS.Modules.BW_SalesInformation.SqlDataProvider.UpdateBW_SalesInformation(Int32 ModuleID, Int32 SaleID, DateTime SaleDate, String SaleTime, DateTime SaleDate2, String SaleTime2, DateTime SaleDate3, String SaleTime3, DateTime SaleDate4, String SaleTime4, DateTime SaleDate5, String SaleTime5, DateTime SaleDate6, String SaleTime6, Boolean SaleClosingClosed, String SaleTitle, DateTime SaleClosingDate, Boolean SaleClosingBySelection, Boolean SaleClosingHasAdditional, String SaleClosingAdditional, String SaleDescription, String SaleWebTitle, String SaleWebDescription, Int32 SaleArea, String HtmlIcons, Boolean Active, Decimal CataloguePrice, Boolean CatalogueOnlinePayments, Boolean Archived) at TIOS.Modules.BW_SalesInformation.BW_SalesInformationController.UpdateBW_SalesInformation(BW_SalesInformationInfo objBW_SalesInformation) at TIOS.Modules.BW_SalesInformation.EditBW_SalesInformation.cmdUpdate_Click(Object sender, EventArgs e) --- End of inner exception stack trace ---
How do I handle the dates correctly so it saves back?
|