Class
DBKit.Row
DBKit.Row
Description
Represents a single row of data from a database table in DBKit.
Properties
Name |
Type |
Read-Only |
|---|---|---|
Methods
Name |
Parameters |
Returns |
|---|---|---|
theLayout As |
||
theLayout As |
||
columnName As String |
||
columnName As String |
||
targetParentTableName As String, viaColumnName As String = "" |
||
Property descriptions
DBKit.Row.Column
Column(name As String) As Variant
The value of the column name in this row.
DBKit.Row.IsBeingEdited
IsBeingEdited As Boolean
Whether the user is currently editing this row. Setting it to True informs the row's controls that editing has begun.
DBKit.Row.IsNew
IsNew As Boolean
Whether this row is new and has not yet been saved to the database.
DBKit.Row.PrimaryKeyValue
PrimaryKeyValue As String
The value of the row's primary key column.
DBKit.Row.Tag
Tag As Variant
A value you can associate with this row.
Method descriptions
DBKit.Row.Constructor
Constructor(theLayout As DBKit.SDK.Layout, relatedTableName As String = "", newRow As Boolean = False)
Called when the row is created. Creates a new row from scratch for the table relatedTableName, or the layout's table if relatedTableName is empty. theLayout is the layout the row belongs to: a DBKit.Window, DBKit.Page or DBKit.Container, all of which are
DBKit.SDK.Layouts. Pass True for newRow to mark the row as new.
Constructor(theLayout As DBKit.SDK.Layout, table As String = "", newRow As Boolean = False, theRow As DatabaseRow)
Called when the row is created. Creates a row from the DatabaseRow theRow for the table table, or the layout's table if table is empty. theLayout is the layout the row belongs to: a DBKit.Window, DBKit.Page or DBKit.Container, all of which are
DBKit.SDK.Layouts.
DBKit.Row.HasChanged
HasChanged() As Boolean
Whether any column value in this row differs from the original row, meaning the row has unsaved changes.
DBKit.Row.HasColumn
HasColumn(columnName As String) As Boolean
Whether this row has a column named columnName.
DBKit.Row.HasValue
HasValue(columnName As String) As Boolean
Whether this row has a value for the column columnName.
DBKit.Row.LoadRelatedParentRows
LoadRelatedParentRows()
Loads the parent rows of the other tables on the layout that are related to this row.
DBKit.Row.ParentRow
ParentRow(targetParentTableName As String, viaColumnName As String = "") As DBKit.Row
Returns the parent row from the table targetParentTableName that is related to this row, optionally reached via the column viaColumnName.
DBKit.Row.Removed
Removed(deleteRelatedRows As Boolean = False) As Boolean
Deletes this row from the database. If deleteRelatedRows is True, rows related to this row are also deleted, working down the one-to-many chain. Returns True if the row was deleted.
DBKit.Row.Saved
Saved() As Boolean
Saves this row to the database, adding it if it is new or updating it if it is not. Returns True if the row was saved.
DBKit.Row.TableName
TableName() As String
Returns the name of the database table this row belongs to.
DBKit.Row.Undo
Undo()
Discards the changes made to this row, restoring its original values from the database.
Notes
Changing a column value in code
Setting a column value in code, for example CurrentRow.Column("LastName") = "Smith", updates any control bound to that column. This only happens while the row is being edited; setting a column value outside of edit mode does not refresh the bound controls.
Return value of Saved
Saved returns True if the row was saved to the database or if the row had no changes to save. It returns False if the save failed, for example because of a database error.
When a new row is added, columns with null values are not written to the database.
Undo restores database values
Undo reverts any changes made to this row before Saved was called, restoring its original values from the database.
Changing a child key loads the parent row
When the value of a child key column is changed, the new parent row is loaded automatically and a Loaded event is sent for the new parent table.
Compatibility
Project Types |
Desktop |
Operating Systems |
All |
See also
Object parent class.