|
![](/_.gif) |
Syntax
Table.insert(tablename,
fields)
Arguments |
Description |
tablename |
Specify
the datatable on which to perform the query. |
fields |
Specify the field-value pairs, i.e., the
fields to receive new data and the data to insert into the datatable. |
|
Returns
Returns
an object. The properties of this object correspond to the fields of the data table, and the values of the properties correspond to the data inserted into the fields.
Description
Inserts one row. Throws an exception in the case of failure.
Fields not specified get their values from the schema
defaults.
Examples
The first example inserts one record into a data table.
//Adds one record, i.e., one row, to the data table "AddressBook"
Table.insert("AddressBook", {LastName:"Smith",
FirstName:"Mark", Email:"marksmith@address.com"});
The second example illustrates the object returned when the update() method is executed.
var rec = Table.insert("AddressBook", {FirstName:"Jim",
LastName:"Smith", email:"JimSmith@address.com"});
//returns 'JimSmith@address.com'
return rec.email;
Related Topics
Table Object,
Table.update(),
Table.delete()
|