RowSet.Close

From Xojo Documentation

Method

RowSet.Close()

New in 2019r2

Supported for all project types and targets.

Closes an open RowSet.

Notes

When the RowSet goes out of scope, it is automatically closed.

If you try to use a RowSet after it has been closed, an UnsupportedOperationException is raised.

Examples

The following method populates a ListBox with a RowSet and closes the RowSet when finished:

Sub PopulateListBox(dataList As Listbox, 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.ColumnAt(-1).WidthExpression = "100"
For i As Integer = 0 To rs.LastColumnIndex
dataList.Heading(i) = rs.ColumnAt(i).Name
Next

// Add the data from the table
While Not rs.AfterLastRow
dataList.AddRow("")

For i As Integer = 0 To rs.LastColumnIndex
dataList.CellValueAt(dataList.LastAddedRowIndex, i) = rs.ColumnAt(i).StringValue
Next

rs.MoveToNextRow
Wend
rs.Close
End Sub