On 2/21/07, Rabbi <[EMAIL PROTECTED]> wrote:
u can use the below api for creating a database:

you have some logical error here:

Err err = 0;
LocalID dbID = DmFindDatabase(0,"BugSquBugsDYTC");
gDB = NULL;

if (dbID > 0) gDB = DmOpenDatabase(0, dbID, dmModeReadWrite);
if (!gDB)
{
err = DmCreateDatabase(0, "BugSquBugsDYTC", 'DYTC', 'DATA', false);

just because you couldn't open the database readwrite; it doesn't
mean you should create it - the database may exist. have you
considered that if it fails; maybe you should delete it before creating
a new database?

DmFindDatabase()
if (localID != NULL) DmCreateDatabase()
DmFindDatabase()

...DmOpenDatabase()

is the standard way to do things; and then handle your opendatabase
errors accordingly (ie: unable to open etc etc)

--
// Aaron Ardiri

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

Reply via email to