Lets say I create a new database table in android and one of the fields in this table is called "Commission" and I assign it a "Real" data type to it. If I then create a new record in this table, but dont assign a value for this "Commission" field, the database will actually store a value of NULL for this field (and NOT a value of "0").
Note: The code in my app treats a null value for commission differently when a value of "0". So I need to be able to tell the difference.
So I have two questions:
1) When reading in a record from the above table, my app will try to load the value of the "Commission" field into the variable "Comm" which I setup as a "double" var type. But I will get a "Invalid double: null" error when trying to assign the null to the variable.
So how can I handle/store a null value for a "Real" database field value into a variable but yet also allow this variable to also store an actual number in it (depending on what the value was in the 'commission' field)?
2) And for records that already have a actual value for commission (i.e "10") in that field, what code would allow me to save/change that value of 10 to a "Null" value for that field?
The reason I am asking this is that I am developing an app that will use data from a Microsoft Access database, and fields of "double" type in an access database can have an actual number assigned to them or a Null stored as its value, and the application treats a Null value differently from the value of "0" and I need to replicate that functionality in my B4A's app database and code.
Note: The code in my app treats a null value for commission differently when a value of "0". So I need to be able to tell the difference.
So I have two questions:
1) When reading in a record from the above table, my app will try to load the value of the "Commission" field into the variable "Comm" which I setup as a "double" var type. But I will get a "Invalid double: null" error when trying to assign the null to the variable.
So how can I handle/store a null value for a "Real" database field value into a variable but yet also allow this variable to also store an actual number in it (depending on what the value was in the 'commission' field)?
2) And for records that already have a actual value for commission (i.e "10") in that field, what code would allow me to save/change that value of 10 to a "Null" value for that field?
The reason I am asking this is that I am developing an app that will use data from a Microsoft Access database, and fields of "double" type in an access database can have an actual number assigned to them or a Null stored as its value, and the application treats a Null value differently from the value of "0" and I need to replicate that functionality in my B4A's app database and code.
Last edited: