I'm pretty sure that DmDelete record does not move the record to the end of
the database. You have to do that yourself with:
DmMoveRecord(pOpenRef, pIndex, DmNumRecords(pOpenRef));
Once you've done that, you can get the count of non-deleted records with:
UInt GetRecordCount(DmOpenRef pOpenRef, UInt pCategory)
{
UInt theFirst = 0;
UInt theLimit = dmMaxRecordIndex;
Err rc;
if(pCategory != dmAllCategories)
rc = DmSeekRecordInCategory(pOpenRef,
&theFirst, 0, dmSeekForward, pCategory);
rc = DmSeekRecordInCategory(pOpenRef,
&theLimit, 0, dmSeekBackward, pCategory);
return rc == 0 ? theLimit + 1 - theFirst : 0;
}
This requires that your database be sorted (primarily) by category.
David
Mitch_Fawcett <[EMAIL PROTECTED]> wrote in message
news:7605@palm-dev-forum...
>
> DmRemoveRecord will remove the record from the database and free the chunk
> of memory it took up. DmNumRecords will not count the record because it
> won't be there anymore.
>
> If you use DmDeleteRecord only the 'delete' bit in the record gets set. It
> then gets moved to the end of the database. It's still there so it gets
> counted by DmNumRecords.
>
> Mitch
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Sam
> Trimble
> Sent: Saturday, April 08, 2000 12:31 PM
> To: Palm Developer Forum
> Subject: DmNumRecords Error
>
>
> Hey, I need to find out how many records there are in a database. Using
the
> DmNumRecords function works pretty good until I delete a record. Then the
> next time it gets called it still returns the same numbers of records it
did
> before the delete. Is there any way I can get around this or any other way
I
> can get the number of database records?
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palm.com/devzone/mailinglists.html
>
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html