Can anyone help, i have multiple databases, i can get one of them to work
o.k, but am unsure how to declaire the 2nd one.
Below shows the first DB which has an info block in the database.
The 2nd is at the bottom, how and were do i declaire the 2nd db
Thanks
adam

DWord PilotMain(Word cmd,Ptr params,Word)//start up forms
{
FormPtr         form;
EventType       event;
Word            error;
DWord           romVersion;     // ROM version
LocalID         dbID;           // Local ID of the database
UInt            cardNum;        // Card number
LocalID         appInfoID;      //  Local ID of the app info block
VoidHand        hAppInfo;       // Handle to the app info block
AppInfoPtr      pAppInfo;       // Points to the app info block



if(((error=DmCreateDatabase(0,"ResDB T018", 'T018',
'hosp',false))!=dmErrAlreadyExists)&&(error!=0))
{
FrmAlert(DBCreationErrorAlert);
return(0);
}
if(ResDB==NULL)
{
ResDB=DmOpenDatabaseByTypeCreato('hosp', 'T018',dmModeReadWrite);
}
else
upStack = true;

//  Get the ID and card number
DmOpenDatabaseInfo( ResDB, &dbID, NULL, NULL, &cardNum, NULL);

//  Get the app info pointer if any
DmDatabaseInfo( cardNum, dbID, NULL, NULL, NULL, NULL, NULL, NULL,NULL,
&appInfoID, NULL, NULL, NULL );

//  If there is no application info block, create one
if( appInfoID == 0 )
{
//  Allocate an application info block
if( (hAppInfo = DmNewHandle( ResDB,sizeof( AppInfoType ) )) == NULL )
errorExit( MemoryErrorAlert );

//  Translate the handle to a local ID
appInfoID = MemHandleToLocalID( hAppInfo );

//  Set the application info block
DmSetDatabaseInfo( cardNum, dbID, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, &appInfoID, NULL, NULL, NULL );

//  Translate the local ID to a pointer
pAppInfo = MemLocalIDToLockedPtr( appInfoID, cardNum );

//  Clear it
DmSet( pAppInfo, 0, sizeof( AppInfoType ), 0 );

//  Initialize the categories
CategoryInitialize( pAppInfo, CategoryLabelsAppInfoStr );

//  Unlock the application info block
MemPtrUnlock( pAppInfo );
}

numRecords1=DmNumRecords(ResDB);
cursor1=0;


//  Display log from
FrmGotoForm(LogForm );

//  Begin the try block
ErrTry

do
{
EvtGetEvent(&event, -1);

if(SysHandleEvent(&event))
continue;

if(event.eType==frmLoadEvent)
{
switch(event.data.frmLoad.formID)
{

// List form
case ListForm:
form = FrmInitForm( ListForm );
FrmSetEventHandler( form,ListHandleEvent );
break;
case ReservationForm:
form=FrmInitForm(ReservationForm);
FrmSetEventHandler(form,ReservationHandleEvent);
break;
} // end switch

FrmSetActiveForm(form);
}
FrmDispatchEvent(&event);
} while (event.eType != appStopEvent);

ErrCatch( errorAlert )
{
//  Display the appropriate alert
FrmAlert( errorAlert );
} ErrEndCatch

FrmCloseAllForms();
DmCloseDatabase(ResDB);



/////////////////////////////////////////////////////////
if(((error=DmCreateDatabase(0,"OrderDB-T018", 'T018',
'hosp',false))!=dmErrAlreadyExists)&&(error!=0))
{
FrmAlert(DBCreationErrorAlert);
return(0);
}

OrderDB=DmOpenDatabaseByTypeCreator('hosp', 'T018',dmModeReadWrite);
numRecords=DmNumRecords(OrderDB);
cursor=0;




DmCloseDatabase(OrderDB);
return(false);
}


______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

-- 
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