Hello everyone,
I have an odd (at least to me) problem with the
database manager: even though
DmOpenDatabaseByTypeCreator() returns 0 (which is
correct because the DB doesn't exist), DmGetLastErr()
returns 0 within the function.
The code below never gets to the part where the DB is
created, because 'err' never evaluates to anything
else but 0.
When I check the value of 'err' within the function,
'err' is always 0, but when the function returns
'err', it evaluates to 'dmErrCantFind' (by checking
the value from the calling function).
I can substitute
if(err == dmErrCantFind)
with
if(err)
and it still does the same.
And if I "force" the code by creating the DB even
though err == 0, I still get an error.
I'm guessing I'm missing something trivial here.
Any help would be much appreciated.
Regards
Michel.P
static Err SecondFormInit()
{
Err err;
DmOpenRef ref = NULL;
ref = DmOpenDatabaseByTypeCreator(DM_TYPE,
DM_CREATOR, dmModeReadWrite);
if(!ref)
{
err = DmGetLastErr();
if(err == dmErrCantFind)
err = DmCreateDatabase(0, DM_NAME, DM_CREATOR,
DM_TYPE, false);
if(err)
return err;
ref = DmOpenDatabaseByTypeCreator(DM_TYPE,
DM_CREATOR, dmModeReadWrite);
if(!ref)
err = DmGetLastErr();
}
db = ref;
return err;
}
__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/