Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 1 (10.1)

Part Number B10119-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

AddNewRecord Method

Applies To

OBinder

ODynaset

Description

This method adds a new record to the dynaset result set.

Usage

oresult AddNewRecord(void)

Remarks

This method adds a new record to the dynaset. OBinder::AddNewRecord adds a new record to the dynaset that it is managing. The added record becomes the current record. Execution of this method sends OADVISE_ADDNEW messages to all attached advisories.

To add a record to a dynaset, first call ODynaset::AddNewRecord, then set the values of whatever fields you wish, then call ODynaset::Update.

To add a record to a managed dynaset (an OBinder instance) call AddNewRecord. The OBinder instance takes care of the rest.

Depending on the options that were used to create the database to which this dynaset is attached, the Oracle database may or may not be called to fill values into some of the fields. See the ODATABASE_ORAMODE under ODatabase.

Note: A call to StartEdit, AddNewRecord, DuplicateRecord, or DeleteRecord, will cancel any outstanding StartEdit, AddNewRecord or DuplicateRecord calls before proceeding. Any outstanding changes not saved using Update will be lost during the cancellation.

When used with OBinder, the method also calls the PreAdd and PostAdd triggers.

Return Value

An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).

Example

This example adds a new record to the emp table. We assume an already open dynaset named empdyn.

// add a record to empdyn

empdyn.AddNewRecord();

// set the values of important fields

empdyn.SetFieldValue("empno", 4512);

empdyn.SetFieldValue("ename", "Scott Feline");

empdyn.SetFieldValue("sal", 1000.45);

// save the change to the Oracle database

empdyn.Update();