Home Home

CreateDatabase

CreateDatabase creates a new ObjectDatabase Control file (*.odc) that contains all the information required control all the tables and transactions within the database.
unsigned int CreateDatabase (
	const char16_t* controlFileName
);

Parameters

controlFileName NULL terminating string that contains the required path for the control file.

Return Values

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

Remarks

  • This methos also opens the database for use.
  • Example Use

    CODBPP database;
    CODBPP::Schema schema;
    //init table schema
    if((error = database.CreateDatabase(_T"C:\\YourDatabase")) == NO_ERROR){
       if((error = database.BeginTransaction(CODBPP::EXCLUSIVE)) == NO_ERROR){
          if((error = database.CreateTable(&schema)) == NO_ERROR){
             ...
          }
       }
       if(error && database.GetErrorMessage(&message) == NO_ERROR)
          MessageBox(message);
       database.EndTransaction();
    }
    else{
       if(database.GetErrorMessage(&message) == NO_ERROR) MessageBox(message);
    }
    database.EndTransaction();
    
    

    Also See

    CloseDatabase, OpenDatabase

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