DatabaseColumn.Value

From Xojo Documentation

Revision as of 20:36, 10 July 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Property (As Variant )
aDatabaseColumn.Value = newVariantValue
or
VariantValue = aDatabaseColumn.Value

New in 2019r2

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.EditRow
rs.Column("MyColumn").Value = Nil // sets to NULL in the database
rs.SaveRow

Sample Code

Get the double value of a column in a RowSet:

// rs is a RowSet with a double column called "InterestRate"
Var interestRate As Double
interestRate = rs.Column("InterestRate").Value // Converts from a Variant to a Double

Set the double value of a column in a RowSet:

// rs is a RowSet with a double column called "InterestRate":
rs.EditRow
rs.Column("InterestRate").Value = 3.625
rs.SaveRow