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.
|