DatabaseField.Value
From Xojo Documentation
This item was deprecated in version 2019r2. Please use DatabaseColumn.Value as a replacement. |
Property (As Variant )
aDatabaseField.Value = newVariantValue
or
VariantValue = aDatabaseField.Value
Supported for all project types and targets.
or
VariantValue = aDatabaseField.Value
Supported for all project types and targets.
Used to get and set the value of a field of any data type.
Notes
The type-specific properties that get and set the values are recommended over Value.
When using this property to assign binary data, no encoding is added.
For situations where you need to set a database column to NULL, you should use the Value property like this:
rs.Edit
rs.Field("MyColumn").Value = Nil // sets to NULL in the database
rs.Update
rs.Field("MyColumn").Value = Nil // sets to NULL in the database
rs.Update
Sample Code
Get the double value of a column in a RecordSet:
// rs is a RecordSet with a double column called "InterestRate"
Dim interestRate As Double
interestRate = rs.Field("InterestRate").Value // Converts from a Variant to a Double
Dim interestRate As Double
interestRate = rs.Field("InterestRate").Value // Converts from a Variant to a Double
Set the double value of a column in a RecordSet:
// rs is a RecordSet with a double column called "InterestRate":
rs.Edit
rs.Field("InterestRate").Value = 3.625
rs.Update
rs.Edit
rs.Field("InterestRate").Value = 3.625
rs.Update