--- Salma Saad <[EMAIL PROTECTED]> wrote:
> I have a demo program in which I create a a database on
> the device and populate it with dummy data. This code
> works perfectly on all Palm devices without expansion
> slots. On the m505 and m500 the database is created
> alright but I get a null handle when I try to insert data.
> <snip>
> static void InitializeInventories()
> {
> Inventory inv1 = {"foodItems", "John", "01/18/2002"};
> VoidHand h = DmNewRecord(inventoryDB, 0, 1);
>
I am surprised that this ever works. In addition to the problem with
'inv' that Bob McKenzie mentioned, DmNewRecord() expects its second
argument to be a pointer to a UInt16, and you passed it 0, which it
probably treats as a NULL pointer. Also, the third argument should be
the size of the new record in bytes. The size isn't a problem if you
are going to resize the record in PackInventory(), but I think the NULL
pointer definitely is a problem. If you want it to add the new record
at the beginning of the database, you should do this:
UInt16 index = 0;
VoidHand h = DmNewRecord(inventoryDB, &index, 1);
and if you want to add the new record at the end of the database, do
this:
UInt16 index = dmMaxRecordIndex;
VoidHand h = DmNewRecord(inventoryDB, &index, 1);
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/