DatabaseRow

From Xojo Documentation

Class (inherits from Object)


New in 2019r2

Used to create new Database rows (records). The methods are used to populate the columns in a row (record).

Methods
BlobColumn ColumnName Int64Column
BooleanColumn ColumnType IntegerColumn
Column CurrencyColumn PictureColumn
ColumnAt DateTimeColumn
ColumnCount DoubleColumn

Notes

Assignments via the DateTimeColumn method store the time as well as the date to support the SQL TimeStamp and Time column types (as well as Date). If you need to store just the time, set the Date portion of the DateTime to 0001-01-01. See the example below.

Not all column types supported by the DatabaseRow class are supported by all data sources. Check whether your data source supports the data type returned by the method you are using.

Use the BlobColumn method to save binary data (such as pictures or files) to the table.

Sample Code

Creates a new row in the team table:

Var row As New DatabaseRow

row.Column("Name") = "Penguins"
row.Column("Coach") = "Bob Roberts"
row.Column("City") = "Boston"
row.DateTimeColumn("StartTime") = New DateTime(1, 1, 1, 6, 0, 0) '6AM - no specific date

Try
myDB.AddRow("Team", row)
Catch error as DatabaseException
MessageBox("DB Error: " + error.Message)
End Try

See Also

Database, DatabaseColumn, MySQLCommunityServer, ODBCDatabase, OracleDatabase, PostgreSQLDatabase, RowSet classes.