I have the following code and function
right after the DmCreateDatabase I get an
error = 537 back. I cant find what this error
is all about.
Funy thing is that I have used this function
in other applications before and worked fine
any suggestions?

----------------------------------------------------------------------------
-----------------------------------------
#define DelTrakAppType  'TRAK'
#define modeRW   dmModeReadWrite
#define dbCarrierType  'appl'
#define dbCarrierName  "CarrierDatabase"

DmOpenRef dbCarrier;

OpenOrCreateDB(&dbCarrier, dbCarrierType, DelTrakAppType, modeRW,
      0, dbCarrierName, &created);

Err OpenOrCreateDB(DmOpenRef *dbP, ULong type, ULong creator, ULong mode,
UInt cardNo, Char *name, Boolean *created)
 {
  Err error;
  LocalID dbID;
  UInt  dbAttrs;

  created = false;

  *dbP = DmOpenDatabaseByTypeCreator(type, creator, mode);
  error = DmGetLastErr();
  if(! *dbP)
  {
  //The database doesn't exist, create it now.
  error = DmCreateDatabase(0, name, creator, type, false);

  //Check for fatal error.
  ErrFatalDisplayIf(error, "Could not create new database.");

  //Find the application's database.
  *dbP = DmOpenDatabaseByTypeCreator(type, creator, mode);

  //Get info about the database
  error = DmOpenDatabaseInfo(*dbP, &dbID, NULL, NULL, 0, NULL);

  //Check for fatal error.
  ErrFatalDisplayIf(error, "Could not get database info.");

  //Get attributes for the database
  error = DmDatabaseInfo(0, dbID, NULL, &dbAttrs, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL);

  //Check for fatal error.
  ErrFatalDisplayIf(error, "Could not get database info.");

  //Set the new attributes in the database
  error = DmSetDatabaseInfo(0, dbID, NULL, &dbAttrs, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL);

  //Check for fatal error.
  ErrFatalDisplayIf(error, "Could not set database info.");
 }
 else if (DmNumRecords(*dbP) == 0)
  *created = true;
 return error;
}
----------------------------------------------------------------------------
--------------------------------------
*********************************************
Silvia Brunet-Jones
Lighthouse Technologies, Inc.
www.lhtek.com
[EMAIL PROTECTED]
*********************************************



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to