[Gambas-devel] Another attempt to sort out empty string being interpreted as null
Benoît Minisini
gambas at ...1...
Sat Feb 27 14:28:59 CET 2010
> Hi List,
>
> We debated this before and though some persons understood what I was
> saying, I don't think there was any resolution, so this time I've got a
> little screen shot to visually demonstrated the problem which is.
>
> When one sets a collection member to any empty sting "" gambas beleives
> this is the same as null and removes the item from the collection
>
> ie mycollection!my_key = "Fred" is valid
> mycollectioin!my_key = "" removes the key from the collection, instead
> of setting its value to an empty string (ie string with no characters.
>
> The implications of this in data saving as illustrated by the picture are
> as follows
>
> Here, the persons name/firstname/salutation were Smith/Stephanie/Steph,
> this record was saved to the database. however I decided to remove
> salutation. As gambas then sets this key to null - effectively removing it
> from the collection, the field in the collection is not updated, and the
> original value is left intact - ie 'steph' in the database field
> 'saluation', is not re-set to an empty string.
>
> I really wonder what can be done about this.
>
> REgards
>
> Richar
>
Why don't you write the "salutation" field?
For Each hField In MyResult.Fields
MyResult[hField.Name] = MyCollection[hField.Name]
Next
MyResult.Update
What's the problem with that?
--
Benoît Minisini
More information about the Devel
mailing list