﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Null Value + DateTime Picker = Exception (but not always)</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 01:39:50 GMT</lastBuildDate><ttl>20</ttl><item><title>Null Value + DateTime Picker = Exception (but not always)</title><link>http://forum.strataframe.net/FindPost27781.aspx</link><description>Hello Friends. &lt;P&gt;I need to save information that is in a DateTimePicker control (in a form of the type of maintenance) with the null value in database and a way to solve this was to include the following code in the Save method Before Bo: &lt;/P&gt;&lt;P&gt;'Field1 &lt;BR&gt;If parmfisc_data_vigencia_final.Text.ToString () = "1/1/1800" Or parmfisc_data_vigencia_final.Text.ToString () = "" Then&lt;/P&gt;&lt;P&gt;boParametros_Fiscais1.CurrentRow (parmfisc_data_vigencia_final ") = DBNull.Value &lt;BR&gt;Else &lt;BR&gt;boParametros_Fiscais1.CurrentRow (parmfisc_data_vigencia_final ") = parmfisc_data_vigencia_final.Text.ToString () &lt;/P&gt;&lt;P&gt;End If &lt;/P&gt;&lt;P&gt;'Field2 &lt;BR&gt;If parmfisc_data_vigencia_inicial.Text.ToString () = "1/1/1800" Or parmfisc_data_vigencia_inicial.Text.ToString () = "" Then &lt;BR&gt;boParametros_Fiscais1.CurrentRow (parmfisc_data_vigencia_inicial ") = DBNull.Value &lt;BR&gt;Else &lt;BR&gt;boParametros_Fiscais1.CurrentRow (parmfisc_data_vigencia_inicial ") = parmfisc_data_vigencia_inicial.Text.ToString () &lt;BR&gt;End If &lt;/P&gt;&lt;P&gt;But I have two problems &lt;/P&gt;&lt;P&gt;1 - When you click Save: When I start the application the first time I click to insert a new record, fill in the registration and click on save, I get the following exception: &lt;/P&gt;&lt;P&gt;BusinessLayerException &lt;BR&gt;&amp;nbsp; An error occurred while saving an the data to the server. &lt;BR&gt;ArgumentOutOfRangeException &lt;BR&gt;&amp;nbsp; Value of '01 / 01/0001 00:00:00 'is not valid for' Value '. 'Value' Should Be between 'MinDate' and 'MAXDATA'. &lt;BR&gt;Parameter name: Value &lt;/P&gt;&lt;P&gt;But if I click on save again, the record is saved and then usually have no more exceptions. during the execution of this module. &lt;/P&gt;&lt;P&gt;&lt;BR&gt;2 - When loading a register via a Browse Dialog: search a record in the Browse dialog that has a date as Null and select it I get the following exception: &lt;/P&gt;&lt;P&gt;BusinessLayerException &lt;BR&gt;&amp;nbsp; An error occurred while refreshing the data from field 'boParametros_Fiscais.parmfisc_data_vigencia_final' to property 'BindableValue' on control 'parmfisc_data_vigencia_final. " Are you missing FieldPropertyDescriptor for a custom property? &lt;BR&gt;ArgumentOutOfRangeException &lt;BR&gt;&amp;nbsp; Value of '01 / 01/0001 00:00:00 'is not valid for' Value '. 'Value' Should Be between 'MinDate' and 'MAXDATA'. &lt;BR&gt;Parameter name: Value &lt;/P&gt;&lt;P&gt;But if I make a filter with a set of records that have dates or not to null I can browse normally and click edit on a record that has null as date, make any changes and click save've no exception . &lt;/P&gt;&lt;P&gt;&lt;BR&gt;What I see is an unstable behavior, because not always an exception. Is there a way to solve this problem?&lt;/P&gt;&lt;P&gt;I apologize for English via Google Translator and thank you in advance!&lt;BR&gt;</description><pubDate>Thu, 29 Jul 2010 15:11:27 GMT</pubDate><dc:creator>Eduardo</dc:creator></item><item><title>RE: Null Value + DateTime Picker = Exception (but not always)</title><link>http://forum.strataframe.net/FindPost27787.aspx</link><description>One solution to the problem was &lt;BR&gt;set the field as BO.field = Nothing</description><pubDate>Thu, 29 Jul 2010 15:11:27 GMT</pubDate><dc:creator>Eduardo</dc:creator></item><item><title>RE: Null Value + DateTime Picker = Exception (but not always)</title><link>http://forum.strataframe.net/FindPost27784.aspx</link><description>[quote][b]Eduardo (07/29/2010)[/b][hr]Edhy Hello, how are you? &lt;br&gt;
&lt;br&gt;
It may seem strange, but I do not have access to the BO, and I'm only working on the application level. &lt;br&gt;
I have owned my DateTimePicker value configured for this alternative. &lt;br&gt;
I do not know if there is a way to solve this without changing the BO.[/quote]&lt;br&gt;
&lt;br&gt;
Well, that should be the proper way to fix this at the BO level, if you don't have access to the BO to make the changes then you will have to do some coding at the form level where this BO will be used.</description><pubDate>Thu, 29 Jul 2010 12:51:11 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Null Value + DateTime Picker = Exception (but not always)</title><link>http://forum.strataframe.net/FindPost27783.aspx</link><description>Edhy Hello, how are you? &lt;/P&gt;&lt;P&gt;It may seem strange, but I do not have access to the BO, and I'm only working on the application level. &lt;BR&gt;I have owned my DateTimePicker value configured for this alternative. &lt;BR&gt;I do not know if there is a way to solve this without changing the BO.</description><pubDate>Thu, 29 Jul 2010 12:29:38 GMT</pubDate><dc:creator>Eduardo</dc:creator></item><item><title>RE: Null Value + DateTime Picker = Exception (but not always)</title><link>http://forum.strataframe.net/FindPost27782.aspx</link><description>Hi Eduardo,&lt;br&gt;
I think you can solve your problem by doing the following:  In the Business Object Mapper, set the following options for you business object:&lt;br&gt;
[quote]NULL Value Option: Return Alternate on Null&lt;br&gt;
NULL Replacement Value: #1/1/1800#&lt;br&gt;
[/quote]&lt;br&gt;
Build Partial, compile your project and test.</description><pubDate>Thu, 29 Jul 2010 12:12:16 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>