Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 1 (10.1) Part Number B10119-01 |
|
Applies To
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();
}