Yes it is perfectly possible
Here is the Start Application of a program that uses 2 dbs, it checks to see
if each one is present, and if not it creates them.
-------------------------------------------------------
#define RouteDBType 'Rout'
#define RouteDBName "Rout-Bust"
#define DestinationDBType 'Dest'
#define DestinationDBName "Dest-Bust"
#define BusCreatorID 'BUST'
static Err StartApplication(void)
{
Err err;
LocalID AppInfoID;
LocalID dbID;
VoidHand dbH;
UInt cardno;
PMyAppInfoType AppInfoP;
CALLBACK_PROLOGUE
// Open databases -> Also performs check to see if they exist
RouteDB = DmOpenDatabaseByTypeCreator(RouteDBType, BusCreatorID,
dmModeReadWrite);
if (!RouteDB)
{
FrmCustomAlert(dlgDatabase,"Route Database","",NULL);
err = DmCreateDatabase(0, RouteDBName, BusCreatorID, RouteDBType,
false);
if (err)
FrmCustomAlert(dlgMsgBox,"Route Database","Error Creating",NULL);
else
{
// re-open new database
RouteDB = DmOpenDatabaseByTypeCreator(RouteDBType, BusCreatorID,
dmModeReadWrite);
// now create the application info block
if(DmOpenDatabaseInfo(RouteDB, &dbID, NULL, NULL, &cardno, NULL))
return dmErrMemError;
// Get New Handle
dbH = DmNewHandle(RouteDB, sizeof(MyAppInfoType));
if (!dbH)
return dmErrMemError;
// Convert handle to local ID
AppInfoID = MemHandleToLocalID(dbH);
DmSetDatabaseInfo(cardno, dbID, NULL, NULL, NULL, NULL, NULL, NULL,
NULL,
&AppInfoID, NULL, NULL, NULL);
AppInfoP = (PMyAppInfoType) MemHandleLock(dbH);
DmSet(AppInfoP, 0, sizeof(MyAppInfoType), 0);
MemPtrUnlock(AppInfoP);
}
}
err = 0;
DestinationDB = DmOpenDatabaseByTypeCreator(DestinationDBType,
BusCreatorID, dmModeReadWrite);
if (!DestinationDB)
{
FrmCustomAlert(dlgDatabase,"Destination Database","",NULL);
// Craete Destination DB
err = DmCreateDatabase(0, DestinationDBName, BusCreatorID,
DestinationDBType, false);
if (err)
FrmCustomAlert(dlgMsgBox,"Destination Database","Error Creating",
NULL);
else
{
DestinationDB = DmOpenDatabaseByTypeCreator(DestinationDBType,
BusCreatorID, dmModeReadWrite);
// now create the application info block
if(DmOpenDatabaseInfo(DestinationDB, &dbID, NULL, NULL, &cardno,
NULL))
return dmErrMemError;
// Get New Handle
dbH = DmNewHandle(DestinationDB, sizeof(MyAppInfoType));
if (!dbH)
return dmErrMemError;
// Convert handle to local ID
AppInfoID = MemHandleToLocalID(dbH);
DmSetDatabaseInfo(cardno, dbID, NULL, NULL, NULL, NULL, NULL, NULL,
NULL,
&AppInfoID, NULL, NULL, NULL);
AppInfoP = (PMyAppInfoType) MemHandleLock(dbH);
DmSet(AppInfoP, 0, sizeof(MyAppInfoType), 0);
MemPtrUnlock(AppInfoP);
}
}
// Re-Init Random Seed
SysRandom(TimGetSeconds());
ListActive = false;
FrmGotoForm(frmMain);
CALLBACK_EPILOGUE
return 0;
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Stevie
Sent: 07 June 2000 09:12
To: Palm Developer Forum
Subject: More than one Database
is it possible to make Palm applications that uses more than one database
per application?
If so, how?
Best regards / MVH
Stevie
-
Programmer
Domestic Interactive
[EMAIL PROTECTED]
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/