Class
DatabaseRow
Description
Used to create new Database rows (records). The methods are used to populate the columns in a row (record).
Method descriptions
DatabaseRow.Column
Column(name As String) As DatabaseColumn
Gets the DatabaseColumn for column name.
Column(name As String, Assigns value as Variant)
Sets a value for column name. This is more optimized than using DatabaseColumn.
Creates a new row in the team table:
Var row As New DatabaseRow
row.Column("Name").StringValue = "Penguins"
row.Column("Coach").StringValue = "Bob Roberts"
row.Column("City").StringValue = "Boston"
Try
myDB.AddRow("Team", row)
Catch error As DatabaseException
MessageBox("DB Error: " + error.Message)
End Try
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"
Try
myDB.AddRow("Team", row)
Catch error As DatabaseException
MessageBox("DB Error: " + error.Message)
End Try
DatabaseRow.ColumnAt
ColumnAt(index As Integer) As DatabaseColumn
Returns the DatabaseColumn for the column at position Index.
Get the string value of a column in a DatabaseRow:
' row is a DatabaseRow
Var productName As String
productName = row.ColumnAt(0).StringValue
DatabaseRow.ColumnCount
ColumnCount As Integer
Returns the number of columns in the DatabaseRow.
Sets the number of columns in a listbox (CustomersList) to the number of columns in a database row (row):
CustomersList.ColumnCount = row.ColumnCount
DatabaseRow.Iterator
Iterator As Iterator
Allows iterating through all the columns in the DatabaseRow with For...Each.
Sample code
Creates a new row in the team table:
Var row As New DatabaseRow
row.Column("Name").StringValue = "Penguins"
row.Column("Coach").StringValue = "Bob Roberts"
row.Column("City").StringValue = "Boston"
row.Column("StartTime").DateTimeValue = 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
DatabaseRow.LastColumnIndex
LastColumnIndex As Integer
The index of the last column in the DatabaseRow.
Interfaces
The DatabaseRow class implements the Iterable class interface.
Compatibility
All project types on all supported operating systems.
See also
Object parent class; Database, DatabaseColumn, MySQLCommunityServer, ODBCDatabase, PostgreSQLDatabase, RowSet classes.