Fabrice,
Running your program under Palm OS Emulator and using a debugger, the problem
was obvious. When I ran it, I got an error message saying that low-memory was
being accessed. Clicking on the Debug button in the dialog and breaking into
the debugger, I saw that the access was made in the first call DmNumRecords.
Using the debugger to look at the calling function, I saw that DmNumRecords was
being called with commandeDB and that commandeDB was NULL.
So...you shouldn't call DmNumRecords with an invalid DmOpenRef.
-- Keith Rollin
-- Palm OS Emulator engineer
"Fabrice Meichtry" <[EMAIL PROTECTED]> on 01/11/2001 02:22:30
AM
Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent by: "Fabrice Meichtry" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
cc: (Keith Rollin/US/PALM)
Subject: Fatal error when I'm trying to create multiple databases
Hello,
I have a problem when I'm trying to create more than one database in my
application. When I have one it's working fine but when I try to create one
more, I get a FATAL ERROR.. Someone know of this problem ??
Thx
Here my code :
****************************************************************************
***************************
#define DM_CARDNO 0
#define DM_DBNAME "CommandeDB"
#define DM_DBTYPE 'Comm'
#define DM_DBCREATOR 'Firs'
#define DM_DBNAMEF "FinalCommandeDB"
#define DM_DBTYPEF 'Fina'
#define DM_DBCREATORF 'Firs'
#define DM_DBNAMEA "ArticleDB"
#define DM_DBTYPEA 'Arti'
#define DM_DBCREATORA 'Firs'
//My appStart
commandeDB = DmOpenDatabaseByTypeCreator(DM_DBTYPE, DM_DBCREATOR,
dmModeReadWrite) ;
numRecords = DmNumRecords(commandeDB) ;
if (!commandeDB)
{
err = DmCreateDatabase(DM_CARDNO, DM_DBNAME, DM_DBCREATOR, DM_DBTYPE,
false) ;
if (err)
return err ;
commandeDB = DmOpenDatabaseByTypeCreator(DM_DBTYPE, DM_DBCREATOR,
dmModeReadWrite) ;
if(!commandeDB)
return DmGetLastErr() ;
}
articleDB = DmOpenDatabaseByTypeCreator(DM_DBTYPEA, DM_DBCREATORA,
dmModeReadWrite) ;
numRecordsA = DmNumRecords(articleDB) ;
if (!articleDB)
{
err2 = DmCreateDatabase(DM_CARDNO, DM_DBNAMEA, DM_DBCREATORA,
DM_DBTYPEA, false) ;
if (err2)
return err2 ;
articleDB = DmOpenDatabaseByTypeCreator(DM_DBTYPEA, DM_DBCREATORA,
dmModeReadWrite) ;
if(!articleDB)
return DmGetLastErr() ;
}
saveArticleRecord() ;
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/