Class

# DatabaseColumn

<div class="rst-class">

forsearch

</div>

Database

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

## Description

Used to access the values of columns in a row in a database table.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

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

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                               | Parameters                                                                                                                                                                                                                | Returns | Shared |
|----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
| `PictureValue<databasecolumn.picturevalue_method>` | format As `Picture.Formats<picture.formats>`, quality As `Integer</api/data_types/integer>` = `Picture.QualityDefault</api/graphics/picture>`, `Assigns</api/language/assigns>` value As `Picture</api/graphics/picture>` |         |        |

## Property descriptions

<div id="databasecolumn.blobvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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="databasecolumn.booleanvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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.EditRow
> rs.Column("MyBooleanColumn").Value = Nil ' sets to NULL in the database
> rs.SaveRow
> ```
>
> Get the boolean value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a boolean column called "AllowEmails"
> If rs.Column("AllowEmails").BooleanValue Then
> MessageBox("Emails are allowed.")
> End If
> ```
>
> Set the boolean value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a boolean column called "AllowEmails":
> rs.EditRow
> rs.Column("AllowEmails").BooleanValue = True
> rs.SaveRow
> ```

<div id="databasecolumn.currencyvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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.EditRow
> rs.Column("MyCurrencyColumn").Value = Nil ' sets to NULL in the database
> rs.SaveRow
> ```
>
> Get the currency value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a currency column called "Amount"
> Var amount As Currency
> amount = rs.Column("Amount").CurrencyValue
> ```
>
> Set the currency value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a currency column called "Amount":
> rs.EditRow
> rs.Column("Amount").CurrencyValue = 123.45
> rs.SaveRow
> ```

<div id="databasecolumn.datetimevalue">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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 DateTime = DateTime.Now
> rs.DateTimeColumn("InvoiceDate").DateTime = d
> rs.SaveRow
> ```

<div id="databasecolumn.doublevalue">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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.EditRow
> rs.Column("MyDoubleColumn").Value = Nil ' sets to NULL in the database
> rs.SaveRow
> ```
>
> Get the double value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a double column called "InterestRate"
> Var interestRate As Double
> interestRate = rs.Column("InterestRate").DoubleValue
> ```
>
> Set the double value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a double column called "InterestRate":
> rs.EditRow
> rs.Column("InterestRate").DoubleValue = 3.625
> rs.SaveRow
> ```

<div id="databasecolumn.int64value">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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.EditRow
> rs.Column("MyColumn").Value = Nil ' sets to NULL in the database
> rs.SaveRow
> ```
>
> Get the Int64 value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a Int64 column called "ID"
> Var id As Int64
> id = rs.Column("ID").Int64Value
> ```
>
> Set the Int64 value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a Int64 column called "ID":
> rs.EditRow
> rs.Column("ID").Int64Value = 456789
> rs.SaveRow
> ```

<div id="databasecolumn.integervalue">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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.EditRow
> rs.Column("MyIntegerColumn").Value = Nil ' sets to NULL in the database
> rs.SaveRow
> ```
>
> Get the integer value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with an integer column called "Quantity"
> Var quantity As Integer
> quantity = rs.Column("Quantity").IntegerValue
> ```
>
> Set the integer value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with an integer column called "Quantity":
> rs.EditRow
> rs.Column("Quantity").IntegerValue = 3
> rs.SaveRow
> ```

<div id="databasecolumn.name">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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 `DesktopListBox</api/user_interface/desktop/desktoplistbox>` with a `RowSet</api/databases/rowset>`. It uses the Name and StringValue properties to obtain the columnnames and values:
>
> ``` xojo
> Sub PopulateListBox(dataList As DesktopListBox, rs As RowSet)
> If rs Is Nil Then Return
>
> ' set up listbox state for population
> dataList.RemoveAllRows
>
>     ' Add the DB columns as the heades for the ListBox
>     dataList.ColumnCount = rs.ColumnCount
>     dataList.ColumnAttributesAt(-1).WidthExpression = "100"
>     For i As Integer = 0 To rs.ColumnCount - 1
>     dataList.HeaderAt(i) = rs.ColumnAt(i + 1).Name
>     Next
>
>     ' Add the data from the table
>     While Not rs.AfterLastRow
>     dataList.AddRow("")
>
>     For i As Integer = 0 To rs.LastColumnIndex
>         dataList.CellTextAt(dataList.LastAddedRowIndex, i) = rs.ColumnAt(i + 1).StringValue
>     Next
>
>     rs.MoveToNextRow
>     Wend
> End Sub
> ```

<div id="databasecolumn.nativevalue">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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 RowSet with a BLOB column called "FileData"
> Var data As String
> data = rs.Column("FileData").NativeValue
> ```

<div id="databasecolumn.picturevalue_property">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.PictureValue

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

> Gets the `Picture</api/graphics/picture>` value for the column. To set a picture value, use the `method of the same name<databasecolumn.picturevalue_method>`.
>
> This property is read-only.

<div id="databasecolumn.stringvalue">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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.EditRow
> rs.Column("MyStringColumn").Value = Nil ' sets to NULL in the database
> rs.SaveRow
> ```
>
> Get the string value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a string column called "ProductName"
> Var productName As String
> productName = rs.Column("ProductName").StringValue
> ```
>
> Set the string value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a Rowset with a string column called "ProductName":
> rs.EditRow
> rs.Column("ProductName").StringValue = "Generic Widgets"
> rs.SaveRow
> ```

<div id="databasecolumn.type">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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="databasecolumn.value">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.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.EditRow
> rs.Column("MyColumn").Value = Nil ' sets to NULL in the database
> rs.SaveRow
> ```
>
> Get the double value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' 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</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with a double column called "InterestRate":
> rs.EditRow
> rs.Column("InterestRate").Value = 3.625
> rs.SaveRow
> ```

## Method descriptions

<div id="databasecolumn.picturevalue_method">

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

</div>

<div class="rst-class">

forsearch

</div>

DatabaseColumn.PictureValue

**PictureValue**(format As `Picture.Formats<picture.formats>`, quality As `Integer</api/data_types/integer>` = `Picture.QualityDefault</api/graphics/picture>`, `Assigns</api/language/assigns>` value As `Picture</api/graphics/picture>`)

> Sets the `Picture</api/graphics/picture>` value for the column. You can get the picture value using the `property of the same name<databasecolumn.picturevalue_property>`.
>
> For situations where you need to set a database column to NULL, you should use the Value property like this:
>
> ``` xojo
> rs.EditRow
> rs.Column("MyIntegerColumn").Value = Nil ' sets to NULL in the database
> rs.SaveRow
> ```
>
> Get the picture value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with an picture column called "Photo"
> Var photo As Picture
> photo = rs.Column("Photo").PictureValue
> ```
>
> Set the picture value of a column in a `RowSet</api/databases/rowset>`:
>
> ``` xojo
> ' rs is a RowSet with an picture column called "Photo" and MyPhoto is a picture:
> rs.EditRow
> rs.Column("Photo").PictureValue(Picture.Formats.PNG) = MyPhoto
> rs.SaveRow
> ```

## Notes

Assignments to the `DateTimeValue<databasecolumn.datetimevalue>` property store the time as well as the date. 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 Date, 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<databasecolumn.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<databasecolumn.booleanvalue>`. The `StringValue<databasecolumn.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<databasecolumn.stringvalue>`, `BooleanValue<databasecolumn.booleanvalue>`, `DateTimeValue<databasecolumn.datetimevalue>`, `IntegerValue<databasecolumn.integervalue>`, `DoubleValue<databasecolumn.doublevalue>`, and `PictureValue<databasecolumn.picturevalue_property>`.

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

## Sample code

The following method populates a `DesktopListBox</api/user_interface/desktop/desktoplistbox>` with a `RowSet</api/databases/rowset>`. It uses the Name and StringValue properties to obtain the column names and values:

``` xojo
Sub PopulateListBox(dataList As DesktopListBox, rows As RowSet)
  If rows Is Nil Then Return

    ' set up listbox state for population
    dataList.RemoveAllRows

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

    ' Add the data from the table
   For Each row As DatabaseRow In rows
      dataList.AddRow("")

      For i As Integer = 0 To rows.LastColumnIndex
        dataList.CellTextAt(dataList.LastAddedRowIndex, i) = row.ColumnAt(i).StringValue
      Next

    Next
End Sub
```

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

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

``` xojo
Var myDB As SQLiteDatabase
Var rows As RowSet
rows = myDB.SelectSQL("SELECT * FROM MyTable")
Try
 rows.EditRow
 rows.Column("MyName").Value = Nil ' NULL this field, does not work for all database plugins
 rows.Column("MyID").Value = 23
 rows.Column("MyText").Value = "Test"
 rows.SaveRow
 myDB.CommitTransaction
Catch error As DatabaseException
  MessageBox("Error: " + error.Message)
End Try
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `Database</api/databases/database>`, `DatabaseRow</api/databases/databaserow>`, `RowSet</api/databases/rowset>` classes.

</div>
