I am new to the Palm, however the "...Bible" seems to be a good
reference.  It states that in order for HotSync to automaticall backup a
DB, the DB Type cannot be "DATA" and the backup bit must be set
(dmHdrAttrBackup).  I am doing that (and I checked the value of
attributesP - it is 8 after the intially setting of the backup flag).
Have I missed something obvious?

Todd

function PrepareDatabase:boolean;
const DatabaseType = Rsc('WINE');
var
  dbID: LocalID;
  attributesP: UInt16;
begin
// open database
  Database := DmOpenDatabaseByTypeCreator(DatabaseType, Creator,
dmModeReadWrite);
  if Database = nil then
  begin
    // create a new database
    Result := DmCreateDatabase(0, 'Wines', Creator, DatabaseType, False)
= 0;
    if not Result then
    begin
      FrmCustomAlert(AlertError, 'Can''t create database', '', '');
      Exit;
    end;

    // open a new created database
    Database := DmOpenDatabaseByTypeCreator(DatabaseType, Creator,
dmModeReadWrite or dmModeExclusive);
    if Database = nil then
    begin
      FrmCustomAlert(AlertError, 'Can''t open database', '', '');
      Result := False;
      Exit;
    end;
  end;
  // Set the backup flag
  dbID := DmFindDatabase(0, 'Wines');
  if dbID > 0 then
  begin
    // Get the DB Info
    DmDatabaseInfo(0, dbID, nil, nil, attributesP, nil, nil, nil, nil,
nil, nil, nil, nil);
    attributesP := attributesP or dmHdrAttrBackup;
    DmSetDatabaseInfo(0, dbID, nil, nil, attributesP, nil, nil, nil,
nil, nil, nil, nil, nil);
  end else
    // Whoops!  Error!
    FrmCustomAlert(AlertError, 'Can''t find Wines database', '', '');;
end;
--
Todd Cary
Ariste Software
[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