AllowNullValuesOnNewRow problem


Author
Message
Sam Tenney
Sam Tenney
StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)
Group: StrataFrame Users
Posts: 70, Visits: 3.5K
Business objects have a property named AllowNullValuesOnNewRow which defaults to False.  The StrataFrame help system says "When True, the NewRow() function will automatically initialize the row to prevent any DBNull values from occurring." My first problem is that I think the help system explanation is probably wrong.  I think it should say "When False, the NewRow() function will automatically initialize the row to prevent any DBNull values from occurring." My second problem occurs when I use a non-nullable char data type as the primary key in my SQL table.  When I click the New button on a MaintenanceFormToolStrip to create a new record in that table, I get an error because the NewRow() function does NOT automatically initialize the primary key value to "" regardless of how I set the AllowNullValuesOnNewRow property.  The value of the primary key (which should be initialized to "" as a string) remains as DBNull which causes the error. There must be a reason why primary keys are ignored when initializing new row values, but I cannot imagine what that reason is.  Is this a bug or can somebody help me understand why the framework works this way. Sam Tenney
Reply
Sam Tenney
Sam Tenney
StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)
Group: StrataFrame Users
Posts: 70, Visits: 3.5K
Hi Ivan,

Unfortunately the post you referenced just confuses the issue even more.  In that post, Trent explains that "You have the AllowNullValuesOnNewRow property set to False on a business object, it will automatically initialize the row for you."  That statement agrees with what I believe is correct, but it disagrees with the StrataFrame help system which says referring to that property, "When True, the NewRow() function will automatically initialize the row to prevent any DBNull values from occurring."  But then just to confuse me even more, Trent suggests setting the property to False which is what he said it was already set to.  I am sure this was just a human mistake in typing, but I still don't know which statement is correct, Trent and me or the help system.

And no matter which statement is correct, I have tried both settings and still the primary key value is not being initialized and it remains set to DBNull which causes an error when the StrataFrame code merely tries to access the primary key value and cast it as a string and that happens long before attempting to Save to the database table.

For some unknown reason, the StrataFrame code is skipping past the initialization process for primary keys when adding new records.  I expect there is a good reason for doing that but nobody has been able to explain it to me yet.  And by the way, it looks to me like it would skip past initializing any primary key even if it was not a string type and the error would occur as long as the primary key was to be manually entered by the end user.  And remember, the error occurs before the primary key value is even displayed in the textbox.

Just try it, I don't think you will like it.

Sam Tenney
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search