
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 __int64 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
- C++
#include "ODBPP.h"
#define FIRST_TABLE 1
struct FixedObject{
int First;
double Second;
} *fixedObject;
int wmain(int argc, wchar_t* argv[])
{
unsigned __int64 error;
const char16_t *message;
CODBPP database;
CODBPP::Object object;
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();
return NO_ERROR;
}Also See
NewObject, DeleteObject, ReadObject, RewriteObject, RestoreObjectListen All
Comments (0)

