Skip Headers
Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 2 (10.2)

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

CancelEdit Method

Applies To

ODynaset

Description

This method cancels the edits made to the current record.

Usage

oresult CancelEdit(void)

Remarks

Editing of the current record is begun with the StartEdit method. If you have called StartEdit and then decide to discard any changes you have made, call CancelEdit.

Return Value

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

Example

This example gives everybody a raise, except for managers.

// open a database object

ODatabase odb("ExampleDB", "scott", "tiger");

// open a dynaset on the employee table

ODynaset empdyn(odb, "select * from emp");

OField salf = empdyn.GetField("sal"); // the salary

OField jobf = empdyn.GetField("job"); // the job

// go through all the records

empdyn.MoveFirst();

while (!empdyn.IsEOF())

{

// start editing

empdyn.StartEdit();

// give a raise

salf.SetValue(1000.0 + (double) salf);

// wait a minute, what position does this person have?

if (0 == strcmp("MANAGER", (const char *) jobf))

{ // forget the raise!

empdyn.CancelEdit();

}

else

{ // go ahead and save the raise

empdyn.Update();

}

empdyn.MoveNext();

}