Feedback
Add a DatabaseRow class for typed database inserts
- Status
- Fixed
- Fixed in
- v26.9.4
- Area
- compiler
- Last updated
- 2026-09-28
Upvotes
1 upvote
Uses your Objo forum account.
Public summary
Add a DatabaseRow class and a Database.AddRow(tableName, row) method so apps can insert rows without hand-writing INSERT SQL. Create a DatabaseRow, assign values to named columns with typed assignments, and call AddRow on the connection:
Var row As New DatabaseRow
row.Column("Name") = "Penguins"
row.Column("Age") = 42
row.Column("Joined") = rs.Column("theDate").DateTimeValue
row.Column("Notes") = Nothing
Try
db.AddRow("Team", row)
Catch e As DatabaseException
MessageBox("DB Error: " + e.Message)
End Try
Typed values — including DateTime — bind as real parameters through every supported database engine, only the assigned columns appear in the generated INSERT so schema defaults still apply to the rest, and assigning Nothing inserts an explicit NULL. An AddRowAsync variant matches the existing asynchronous database methods.