Home Home

AddObject

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

Parameters

tableID The table ID defining the table's handle.
object Returns the newly added object's values.
objectID The 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

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

Also See

NewObject, DeleteObject, ReadObject, RewriteObject , RestoreObject

Copyright © 2003-2008, Ekky Software Pty. Ltd.