Could be that DmNewRecord is unable for some reason to allocate a 1 byte
record in position zero and (as you are not testing either Handle or err)
you are then trying to release an invalid record.  I am assuming that the
Record = 0; statement is for debugging, otherwise the preceding if statement
seems to serve no purpose.  However, if you are trying to allocate a record
to the end of the database, it is better to specify dmMaxRecordIndex and
allow the function to save the allocated record number in Record.

Regards, Nick

-----Original Message-----
From: Mike LaPaglia [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 21 October 1999 2:47
To: [EMAIL PROTECTED]
Subject: Re: Codewarrior R5 C++ question.

...

void Period::Store (Int Record)
{
        Err err=0;
        char t[50];
        VoidHand Handle;
        StrIToA(t,(int)this);

        //i = (Int *)MemPtrNew(sizeof(Int));

        if ((Record == noRecordSelected)||(Record >= Count))
        {       Record = Count;
        }
        Record =0;
        Handle = DmNewRecord(PeriodDB, (UInt*)&Record,1);
        err=DmGetLastErr();
        err=DmReleaseRecord(Handle,0,true);
        if (0==err)
                Pack(Record);
        //MemPtrFree(i);
}

The problem is pretty consistant.  I have tried various forms
but always get the Buss error on the console when the DmReleaseRecord
is called.

What is my malfunction here?  It is code similar to other times
I have used it and it works fine.

Reply via email to