By using the cmdInsert object and its associated methods you can insert records into a data table.
Insertion into a long text field is not presently supported.
Constructor
[new] cmdInsert
(tablename) |
Constructs and returns a new cmdInsert object instance. The tablename string argument designates the table to be affected. The tablename must be quote enclosed. |
|
Instance Methods
execute |
Inserts data into the specified data table
|
getFields |
Returns the cmdInsert object's field settings as specified by the setFields() method. |
getTablename |
Returns the name of the table specified in the cmdInsert constructor. |
setFields |
Sets the fields for the cmdInsert object. |
|
Example
The following example inserts a record into the AddressBook table. It writes "John" to the FirstName field, "Smith" to the LastName field, and "johnsmith@address.com" to the Email field.
//Creates a new cmdInsert object and identifies
//the table, "Addressbook", to be affected.
var ins = new cmdInsert("Addressbook");
//Identifies the fields of the Addressbook table
//and the data to be written in those fields.
ins.setFields({FirstName:"John", LastName:"Smith",
Email:"johnsmith@address.com"});
//Inserts a new record in the Addressbook table.
//"John" is written to the FirstName field,
//"Smith" is written to the LastName field,
//and "johnsmith@address.com" is written to the Email field.
ins.execute();
var ins = new cmdInsert("Addressbook");
ins.setFields({FirstName:"John", LastName:"Smith", Email:"johnsmith@address.com"});
ins.execute();