AddObject

AddObject adds the object currently handled by a table, using NewObject if there is not currently an object within the table handle otherwise a dulicate object will be added.
unsigned int AddObject (
   unsigned int tableID,
   CODBPP::Object *object = NULL,
   __int64 objectID = 0
);

Parameters

tableIDthe table ID defining the table's handle.
objectreturns the newly added object's values.
objectIDthe ID required for the new object, 0 for the next available.

Return Values

If the method succeeds, the return value is zero else see error codes for more details.

Remarks

Example Use
#define FIRST_TABLE 1
CODBPP::Object object;
struct FixedObject{
   int First;
   double Second;
} *fixedObject;
if((error = database.BeginTransaction()) == NO_ERROR
&& (error = database.OpenTable(FIRST_TABLE)) == NO_ERROR
&& (error = database.NewObject(FIRST_TABLE,&object)) == NO_ERROR){
   fixedObject = (struct FixedObject*)object.fixed;
   fixedObject->First = 456;
   fixedObject->Second = 456.789;
   if((error = database.AddObject(FIRST_TABLE)) == NO_ERROR)
      error = database.CommitTransaction();
}
if(error && database.GetErrorMessage(&message) == NO_ERROR)
   MessageBox(message);
database.EndTransaction();

Also See

NewObject, DeleteObject, ReadObject, RewriteObject, RestoreObject
Comments (0)Listen All
Characters left: 2500
 
Ekky Software Homepage Ekky Software Homepage ObjectDatabase++ TScript Ekky Software Homepage Ekky Software Homepage ObjectDatabase++ TScript