<div class="meta" robots="noindex">

</div>

Class

# DatabaseField

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `DatabaseColumn</api/databases/databasecolumn>` as a replacement.

</div>

## Description

Used to access the values of fields in a record in a database table.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                         | Type                                            | Read-Only | Shared |
|----------------------------------------------|-------------------------------------------------|-----------|--------|
| `BlobValue<databasefield.blobvalue>`         | `String</api/data_types/string>`                |           |        |
| `BooleanValue<databasefield.booleanvalue>`   | `Boolean</api/data_types/boolean>`              |           |        |
| `CurrencyValue<databasefield.currencyvalue>` | `Currency</api/data_types/currency>`            |           |        |
| `DateTimeValue<databasefield.datetimevalue>` | `DateTime</api/data_types/datetime>`            |           |        |
| `DateValue<databasefield.datevalue>`         | `Date</api/deprecated/date>`                    |           |        |
| `DoubleValue<databasefield.doublevalue>`     | `Double</api/data_types/double>`                |           |        |
| `Int64Value<databasefield.int64value>`       | `Int64</api/data_types/additional_types/int64>` |           |        |
| `IntegerValue<databasefield.integervalue>`   | `Integer</api/data_types/integer>`              |           |        |
| `Name<databasefield.name>`                   | `String</api/data_types/string>`                | ✓         |        |
| `NativeValue<databasefield.nativevalue>`     | `String</api/data_types/string>`                | ✓         |        |
| `PictureValue<databasefield.picturevalue>`   | `Picture</api/graphics/picture>`                |           |        |
| `StringValue<databasefield.stringvalue>`     | `String</api/data_types/string>`                |           |        |
| `Type<databasefield.type>`                   | `Integer</api/data_types/integer>`              | ✓         |        |
| `Value<databasefield.value>`                 | `Variant</api/data_types/variant>`              |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                 | Parameters                                   | Returns                          | Shared |
|--------------------------------------|----------------------------------------------|----------------------------------|--------|
| `GetString<databasefield.getstring>` |                                              | `String</api/data_types/string>` |        |
| `SetString<databasefield.setstring>` | newValue As `String</api/data_types/string>` |                                  |        |

## Property descriptions

<div id="databasefield.blobvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.BlobValue

**BlobValue** As `String</api/data_types/string>`

Used to get and set the values of Blob (Binary Large OBject) field types.

If the field is not of this type, BlobValue will try to return the value as a `String</api/data_types/string>`. `SQLiteDatabase</api/databases/sqlitedatabase>` converts text to UTF-8 text encoding.

When using this property to assign binary data, no encoding is added.

<div id="databasefield.booleanvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.BooleanValue

**BooleanValue** As `Boolean</api/data_types/boolean>`

Used to get and set the values of `Boolean</api/data_types/boolean>` field types.

The values "0" and "False" are treated as `False</api/language/false>` and "1" and "True" are treated as `True</api/language/true>`. The behavior of any other values is undefined when retrieved using BooleanValue. Use StringValue to retrieve the original values in the field.

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.Edit
rs.Field("MyBooleanColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

Get the boolean value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a boolean column called "AllowEmails"
If rs.Field("AllowEmails").BooleanValue Then
  MsgBox("Emails are allowed.")
End If
```

Set the boolean value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a boolean column called "AllowEmails":
rs.Edit
rs.Field("AllowEmails").BooleanValue = True
rs.Update
```

<div id="databasefield.currencyvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.CurrencyValue

**CurrencyValue** As `Currency</api/data_types/currency>`

Used to get and set the values of `Currency</api/data_types/currency>` field types.

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.Edit
rs.Field("MyCurrencyColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

Get the currency value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a currency column called "Amount"
Dim amount As Currency
amount = rs.Field("Amount").CurrencyValue
```

Set the currency value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a currency column called "Amount":
rs.Edit
rs.Field("Amount").CurrencyValue = 123.45
rs.Update
```

<div id="databasefield.datetimevalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.DateTimeValue

**DateTimeValue** As `DateTime</api/data_types/datetime>`

Used to get and set the values of `DateTime</api/data_types/datetime>` field types.

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.EditRow
rs.DateTimeColumn("MyDateColumn").Value = Nil ' sets to NULL in the database
rs.SaveRow
```

Get the date value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RowSet with a date column called "InvoiceDate"
Var invoiceDate As DateTime
invoiceDate = rs.Column("InvoiceDate").DateTimeValue
```

Set the date value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RowSet with a date column called "InvoiceDate":
rs.EditRow
Var d As New DateTime
rs.DateTimeColumn("InvoiceDate").DateTime = d
rs.SaveRow
```

<div id="databasefield.datevalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.DateValue

**DateValue** As `Date</api/deprecated/date>`

Used to get and set the values of `DateTime</api/data_types/datetime>` field types.

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.Edit
rs.Field("MyDateColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

Get the date value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a date column called "InvoiceDate"
Dim invoiceDate As Date
invoiceDate = rs.Field("InvoiceDate").DateValue
```

Set the date value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a date column called "InvoiceDate":
rs.Edit
Dim d As New Date
rs.Field("InvoiceDate").Date = d
rs.Update
```

<div id="databasefield.doublevalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.DoubleValue

**DoubleValue** As `Double</api/data_types/double>`

Used to get and set the values of `Double</api/data_types/double>` field types.

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.Edit
rs.Field("MyDoubleColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

Get the double value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a double column called "InterestRate"
Dim interestRate As Double
interestRate = rs.Field("InterestRate").DoubleValue
```

Set the double value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a double column called "InterestRate":
rs.Edit
rs.Field("InterestRate").DoubleValue = 3.625
rs.Update
```

<div id="databasefield.int64value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.Int64Value

**Int64Value** As `Int64</api/data_types/additional_types/int64>`

Used to get and set the values of `Int64</api/data_types/additional_types/int64>` field types.

Support for 64-bit integers is at the framework level. Database plug-ins need to be updated to support 64-bit integers.

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.Edit()
rs.Field("MyColumn").Value = Nil ' sets to NULL in the database
rs.Update()
```

Get the Int64 value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a Int64 column called "ID"
Dim id As Int64
id = rs.Field("ID").Int64Value
```

Set the Int64 value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a Int64 column called "ID":
rs.Edit
rs.Field("ID").Int64Value = 456789
rs.Update
```

<div id="databasefield.integervalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.IntegerValue

**IntegerValue** As `Integer</api/data_types/integer>`

Used to get and set the values of `Integer</api/data_types/integer>` field types.

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.Edit
rs.Field("MyIntegerColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

Get the integer value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with an integer column called "Quantity"
Dim quantity As Integer
quantity = rs.Field("Quantity").IntegerValue
```

Set the integer value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with an integer column called "Quantity":
rs.Edit
rs.Field("Quantity").IntegerValue = 3
rs.Update
```

<div id="databasefield.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.Name

**Name** As `String</api/data_types/string>`

Used to get the name of the column.

This property is read-only.

The following method populates a `ListBox</api/deprecated/listbox>` with a `RowSet</api/databases/rowset>`. It uses the Name and StringValue properties to obtain the fieldnames and values:

``` xojo
Sub PopulateListBox(dataList As Listbox, rs As RecordSet)
  If rs Is Nil Then Return

  ' set up listbox state for population
  dataList.DeleteAllRows
  dataList.Columncount = rs.Fieldcount

    ' Add the DB columns as the heades for the ListBox
    dataList.ColumnCount = rs.FieldCount
    dataList.Column(-1).WidthExpression = "100"
    For i As Integer = 0 To rs.FieldCount - 1
      dataList.Heading(i) = rs.IdxField(i + 1).Name
    Next

    ' Add the data from the table
    While Not rs.EOF
      dataList.AddRow("")

      For i As Integer = 0 To rs.FieldCount - 1
        dataList.Cell(dataList.LastIndex, i) = rs.IdxField(i + 1).StringValue
      Next

      rs.MoveNext
    Wend
End Sub
```

<div id="databasefield.nativevalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.NativeValue

**NativeValue** As `String</api/data_types/string>`

Used to get the values of fields in their native encoding. Useful for reading blobs from database fields. Use `Value<databasecolumn.value>` or `StringValue<databasecolumn.stringvalue>` to set Blob values in database fields.

This property is read-only.

Get the native value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a BLOB column called "FileData"
Dim data As String
data = rs.Field("FileData").NativeValue
```

<div id="databasefield.picturevalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.PictureValue

**PictureValue** As `Picture</api/graphics/picture>`

Gets or sets the PictureValue.

For most databases you will want to use the NativeValue property instead.

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.Edit
rs.Field("MyColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

Get the picture value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a picture column called "ProductImage"
Dim productImage As Picture
productImage = rs.Field("ProductImage").PictureValue
```

Set the picture value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a picture column called "ProductImage":
rs.Edit
rs.Field("ProductImage").PictureValue = Canvas1.Backdrop
rs.Update
```

Get the picture value of a column in a `RowSet</api/databases/rowset>`, converting it to JPEG:

``` xojo
' rs is a RecordSet with a picture column called "ProductImage"
Dim productImage As Picture
productImage = rs.Field("ProductImage").PictureValue(Picture.FormatJPEG)
```

<div id="databasefield.stringvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.StringValue

**StringValue** As `String</api/data_types/string>`

Used to get and set the values of `String</api/data_types/string>`/Character field types.

If the field is not of this type, StringValue will try to return the value as a `String</api/data_types/string>`. `SQLiteDatabase</api/databases/sqlitedatabase>` converts text to UTF-8 text encoding.

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:

``` xojo
rs.Edit
rs.Field("MyStringColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

Get the string value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a string column called "ProductName"
Dim productName As String
productName = rs.Field("ProductName").StringValue
```

Set the string value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a string column called "ProductName":
rs.Edit
rs.Field("ProductName").StringValue = "Generic Widgets"
rs.Update
```

<div id="databasefield.type">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.Type

**Type** As `Integer</api/data_types/integer>`

Used to get the values of type of a column.

This property is read-only.

See `RowSet.ColumnType<rowset.columntype>` for a list of integers and their associated types.

<div id="databasefield.value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.Value

**Value** As `Variant</api/data_types/variant>`

Used to get and set the value of a field of any data type.

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:

``` xojo
rs.Edit
rs.Field("MyColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

Get the double value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' 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
```

Set the double value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a double column called "InterestRate":
rs.Edit
rs.Field("InterestRate").Value = 3.625
rs.Update
```

## Method descriptions

<div id="databasefield.getstring">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.GetString

**GetString** As `String</api/data_types/string>`

Gets the value of the field as a `String</api/data_types/string>`.

This is equivalent to using StringValue to get the value.

Get the string value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a string column called "ProductName"
Dim productName As String
productName = rs.Field("ProductName").GetString
```

<div id="databasefield.setstring">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DatabaseField.SetString

**SetString**(newValue As `String</api/data_types/string>`)

Sets the value of the field to the passed `String</api/data_types/string>`.

This is equivalent to using `StringValue<databasecolumn.stringvalue>` to set the value.

Set the string value of a column in a `RowSet</api/databases/rowset>`:

``` xojo
' rs is a RecordSet with a string column called "ProductName":
rs.Edit
rs.Field("ProductName").SetString("Generic Widgets")
rs.Update
```

## Notes

Assignments to the DateValue property store the time as well as the date, as with `DatabaseRecords</api/databases/databaserow>`. When getting a value, the resulting `DateTime</api/data_types/datetime>` object may contain a time as well as a date. For fields of type `DateTime</api/data_types/datetime>`, the time will be 00:00:00 (midnight); and for fields of type Time, the date will be January 1, 0001. Fields of type TimeStamp contain valid data for both the date and time.

`Boolean</api/data_types/boolean>` fields are strict about what they expect when using the BooleanValue function: "0" and "False" are treated as `False</api/language/false>` and "1" and "True" are treated as `True</api/language/true>`. The behavior of any other values is undefined when retrieved using BooleanValue. The StringValue property, on the other hand, should be able to retrieve the original data if it can't be identified as a `Boolean</api/data_types/boolean>`.

The conversion operator, `Operator Convert</api/language/operators/operator_overloads/operator_convert>`, has been added to StringValue, BooleanValue, DateValue, IntegerValue, and DoubleValue.

Typically you should use the type-specific "Value" properties to get and set values from the database.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Null columns

The properties that return intrinsic value types (Boolean, Currency, Double, Int64, Integer, String) all return their appropriate default value if the database column is NULL.

To check if a column is NULL, use the Value property like this:

``` xojo
If rs.Field("MyColumn").Value Is Nil Then
  ' Column value is NULL
End If
```

For situations where you need to set a database column to NULL, you should use the Value property like this:

``` xojo
rs.Edit
rs.Field("MyColumn").Value = Nil ' sets to NULL in the database
rs.Update
```

## Sample code

The following method populates a `ListBox</api/deprecated/listbox>` with a `RowSet</api/databases/rowset>`. It uses the Name and StringValue properties to obtain the fieldnames and values:

``` xojo
Sub PopulateListBox(dataList As Listbox, rs As RecordSet)
  If rs Is Nil Then Return

  ' set up listbox state for population
  dataList.DeleteAllRows
  dataList.Columncount = rs.Fieldcount

    ' Add the DB columns as the heades for the ListBox
    dataList.ColumnCount = rs.FieldCount
    dataList.Column(-1).WidthExpression = "100"
    For i As Integer = 0 To rs.FieldCount - 1
      dataList.Heading(i) = rs.IdxField(i + 1).Name
    Next

    ' Add the data from the table
    While Not rs.EOF
      dataList.AddRow("")

      For i As Integer = 0 To rs.FieldCount - 1
        dataList.Cell(dataList.LastIndex, i) = rs.IdxField(i + 1).StringValue
      Next

      rs.MoveNext
    Wend
End Sub
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The following code uses the Value property to set the values of fields of different data types.

``` xojo
Dim myDB As RealSQLDatabase
Dim rs As RecordSet
rs = myDB.SQLSelect("SELECT * FROM MyTable")
rs.Edit
rs.Field("MyName").Value = Nil ' NULL this field, does not work for all database plugins
rs.Field("MyID").Value = 23
rs.Field("MyText").Value = "Test"
rs.Update
If Not myDB.Error Then
  myDB.Commit
Else
  MsgBox("Error: " + myDB.ErrorMessage)
End If
```

## Compatibility

All project types on all supported operating systems.

## See also

`DatabaseColumn</api/databases/databasecolumn>` parent class; `Database</api/databases/database>`, `DatabaseRow</api/databases/databaserow>`, `RowSet</api/databases/rowset>` classes.
