Object

DatabaseRecord Class

Used to create new Database records. The methods are used to populate the fields in a record.

Methods
BlobColumn
BooleanColumn
Column
DateColumn
DoubleColumn
IntegerColumn
JPEGColumn
MacPictColumn

# Notes

Call it once per column in the record.

Assignments to the DateColumn property now store the time as well as the date, to support the SQL TimeStamp and Time field types (as well as Date). Note that if the date part is January 1, 0001, then this is converted to SQL as only a time (e.g., "18:54:00"), whereas if the date is anything else, it converts to SQL in full form (e.g., "2000-5-30 18:54:00").

# Example

The following example creates a new REALSQLdatabase, an employees table, and adds a record to the table.

Dim dbFile as FolderItem
Dim db as REALSQLdatabase
db= New REALSQLdatabase
Dim mydate as New Date
Dim rec as DatabaseRecord
dbFile = GetFolderItem("Pubs")
db.DatabaseFile = dbFile
If db.CreateDatabaseFile Then
db.SQLExecute("create table employees(id integer, name varchar," _
+"jobtitle varchar, DOB date, Salary double)")
rec = New DatabaseRecord
rec.IntegerColumn("id") =1
rec.Column("name") = "Lois Lane"
rec.Column("jobtitle")="Pundit"
mybool=ParseDate("1Jan1950",mydate)
rec.DateColumn("DOB")=mydate
rec.DoubleColumn("Salary")=105000
db.InsertRecord("employees",rec)
db.Commit
else
MsgBox "Error: "+db.ErrorMessage
End if

# See Also

Database, Database4DServer, DatabaseField, ODBCDatabase, OpenBaseDatabase, OracleDatabase, PostgreSQLDatabase, REALSQLdatabase, RecordSet classes; OpenCSVCursor, OpenDBFCursor, OpenDTFDatabase functions.