Unable to set fields to NULL when creating a new object

DObject O/R Mapping Suite

Unable to set fields to NULL when creating a new object


wasuplee123 09-08-2008, 6:45 PM
When I try to create a new object like this:
MyObject = TMyObject.Create(OM);
MyObject.Date := Now;
MyObject._Subject.Value := Null;
MyObject.Save;
It sets the Subject field to a blank string, not NULL.
If I use this workaround, it does work:

MyObject = TMyObject.Create(OM);
MyObject.Date := Now;
MyObject.Save;

MyObject := TMyObject.GetByID(OM, MyObject.ID); // ID is an auto-increment field
MyObject._Subject.Value := Null;
MyObject.Save;

It seems to work fine whenever you set a field to NULL on an existing record in the database, but if you try to set it to NULL on a new object, it gets set to a zero value instead.

Re: Unable to set fields to NULL when creating a new object


Bill 09-09-2008, 9:21 AM
We'll check this and come back to you.

Powered by Community Server, by Telligent Systems