SimpleDataset addRecord()
syntax: |
simpledataset.addRecord(record) |
where: |
record - Object whose properties contain the values of the fields of the record to be added to the database table.
|
return: |
boolean - value indicating success. In the case that the operation failed, use the getLastErrorCode() and getLastError() methods to determine the reason for the failure.
|
description: |
This method inserts the specified record into the SimpleDataset and its associated database table. The record to be inserted will have the field values indicated by the properties of the object passed into addRecord. After inserting a new record, the current record is left unchanged.
Note that no guarantees are made about the position of the inserted record within the SimpleDataset.
|
see: |
#include <smdtset.jsh>, SimpleDataset deleteRecord(), SimpleDataset deleteAll()
|
example: |
// The following function opens a SimpleDataset, // adds the city // Boston, Massachusetts to it, // and then closes it down function add_city(db, table, user, passwd) { var ds = new SimpleDataset(db, table, user, passwd );
// set up the field values // of the item to be added var record; record.city = "Boston"; record.country = "USA"; record.state = "Massachusetts"; record.population = 500000;
// add the item and clean up ds.addRecord( record ); ds.close(); } |