Adding New Records to a Database Table

To add records to a database table, first construct one or more property lists containing properties that match the columns in the table. Then use the add record or add records command to add those records to the table:

set myTable to table "Members" of myDB

set newMember to (firstName:"Fritz", lastName:"Geisler", memberNumber:4307)

add record newMember to myTable-- newMember must have all required values

Using the add records command, a long list of records may be added to the table with a single command.

A database table may have various rules associated with it. For example, some columns may be optional and others be required to have a value assigned in every record. Or a column such as memberNumber might be required to be unique meaning that each record in the table must have a different memberNumber value. If you attempt to add a record to the database that violates one of these rules, it will be rejected, and an exception will be thrown in the script.


This topic was last updated on January 15, 2020, at 03:27:21 PM.

Eggplant icon | Documentation Home | User Forums | Support | Copyright © 2020 Eggplant