﻿<?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?)  » Handling null value</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 24 Jun 2026 18:57:39 GMT</lastBuildDate><ttl>20</ttl><item><title>Handling null value</title><link>http://forum.strataframe.net/FindPost6423.aspx</link><description>Hi,&lt;br&gt;
I have a table with 3 fields&lt;br&gt;
&lt;br&gt;
[quote]Field Name        Type             ALlow NULL     PK         Indentity&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
ID                    int                          No                Yes        Yes&lt;br&gt;
Descr               varchar(30)              No                No          No&lt;br&gt;
FKID                 int                          Yes              No          No&lt;br&gt;
&lt;br&gt;
[/quote]&lt;br&gt;
&lt;br&gt;
I set my BO to map to this table, set ID and Descr to Do Not Allow NULL; FKID to Use nullable generic in BO mapper allow null option. When I save new record, I found that FKID is always ZERO instead of NULL if I leave FKID blank (bound in combobox). I figured out that myBO.AllowNullValuesOnNewRow = false.&lt;br&gt;
&lt;br&gt;
So, I try to set myBO.AllowNullValuesOnNewRow = true but then I will hit error complaint that system unable to convert DBNull to string for textbox. I was thinking to change "Descr" to use "Return alternate on null" option.&lt;br&gt;
&lt;br&gt;
May I know is it the prefered way? Or, any recommendation?&lt;br&gt;
&lt;br&gt;
Thank you</description><pubDate>Thu, 01 Feb 2007 08:48:22 GMT</pubDate><dc:creator>Chan</dc:creator></item><item><title>RE: Handling null value</title><link>http://forum.strataframe.net/FindPost6486.aspx</link><description>The CurrentRow property is a DataRow object reference, not a wrapper for a DataRow, and the DataRow class does not have GetXXX methods like the DbDataReader class does.&amp;nbsp; Generating the code in the properties was the most efficient solution.</description><pubDate>Thu, 01 Feb 2007 08:48:22 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Handling null value</title><link>http://forum.strataframe.net/FindPost6479.aspx</link><description>Hi,&lt;/P&gt;&lt;P&gt;I think that is better change the code generate to, like it :&lt;/P&gt;&lt;P&gt;public string MyField&lt;BR&gt;{&lt;BR&gt;&amp;nbsp; get { &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&amp;nbsp;CurrentRow.GetString("myField");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { CurrentRow["myField"] = value; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;The "CurrentRow" class must have GetXXXXX for each type, like GetInt(..), GetDate(...), so you can return values more easy, like "null".&lt;/P&gt;&lt;P&gt;Regards,&lt;BR&gt;Alexnaldo Santos</description><pubDate>Wed, 31 Jan 2007 19:48:19 GMT</pubDate><dc:creator>Alexnaldo C Santos</dc:creator></item><item><title>RE: Handling null value</title><link>http://forum.strataframe.net/FindPost6446.aspx</link><description>Strings do not support a nullable generic.&amp;nbsp; You will have to use the "Return Alternate Value" option for a string.&amp;nbsp; Generally when this is selected for a string, then you want to set the return value as "".&amp;nbsp;</description><pubDate>Tue, 30 Jan 2007 16:56:24 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>