> first, the obvious stuff:
> - where does it crash?

I have a form that contains a list control.  It crashes when that form
opens, after displaying the list and after it shows the record count 
popup.    The only other thing the form does is call: 
GetImportNames().  GetImportNames() has been commented out to do 
nothing except what is shown below.  The exact text is shown below.

> - how many iterations thru the loop before it crashes?

Have not determined that yet.

> - what exactly are you doing in the "Do something here" part?

Nothing!  I have only left a place to do something.  The only code in 
that function is shown below.  If I comment out everything in the 
'for' loop, it does not crash (fatal error).

> - are you sure ImportDB is really pointing at the memopad database?

I use:

void OpenImportDB(void) {
    curIdx = 0;
    ImportDB = DmOpenDatabaseByTypeCreator(DBTYPE2,
        CREATORID2, dmModeReadWrite);
    if (!ImportDB)
    {
        FrmCustomAlert(altNotice, "MemoDB not found!", "Create with   
            MemoPad", "Thanks");
    }
}

to get ImportDB.

> - did you verify under the debugger that DmNumRecords really returned 535,
> or could there be an error in your popup debugging code?

I did load the MemoDB right after hot-syncing, into POSE and ran the 
application.  It showed a different larger number of records.  Wierd.

Anyway, it might be easier just to show me how to do the following as 
simply as possible.

Open the MemoDB
Read the first 6 characters from the first 10 records into an 
array.

that's it!  That is what I was trying to do.  I have the 
OpenDatabase() function and the GetImportNames() to read the first 6 
chars, of the first 10 records, into an array.  All of _that_ code 
has been commented out to isolate the problem.  The code that I have 
shown is all the code envolved in this attempt.

Since, this code causes a fatal error, there must be something wrong. 
 BTW, I have also tried DmQueryNextInCategory() just in case there
was something wrong with DmQueryRecord.

This is odd!

> now, something interesting:
>     i've seen databases that have somehow become corrupted, where the
> specific effect of the corruption is that the database claims to have many
> many many more records than it actually has.  trying to install the
> database onto POSE yields a "database corrupt" error.  however, the
> database for the most part seems to work (and if i tweak POSE to load the
> database anyway, it basically works, too).  your symptoms sound identical
> to this problem. everyone for whom i've seen this kind of corruption
> happen has been using MacPac v2.  (i've seen it happen to 7 different
> users, one of whom claims every time he does a HotSync it corrupts his
> database, even if he is starting fresh from a hard reset).
> 
> 
> 
> ----- Original Message -----
> From: Mike Davis <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 23, 1999 6:14 PM
> Subject: Re: Reading/Writing MemoPad DBs ???
> 
> 
> > more info on problem #1 -- DmNumRecords will tell you total records
> > including deleted records.  DmNumRecordsInCategory will tell you how
> > many live records there are (to get all live records, specify
> > dmAllCategories).
> 
> First, I sync several times a day.  Shouldn't that get rid of any
> deleted records?  I find it hard to believe that I can have almost
> 400 deleted records since I hardly ever use MemoPad.
> 
> Second, when I execute this code within the 'for' statement, the
> system gives me a fatal error and resets.  If I comment out the:
>     RecHandle = DmQueryRecord(ImportDB, i);
>     RecPointer = MemHandleLock(RecHandle);
>     // Do something here
>     // to access specific data
>     MemPtrUnlock(RecPointer);
> lines, it does not crash.  So it has something to do with this.
> Now, since I suspect that the numRec is higher than it should be,
> maybe that is causing access to areas that do not exist.
> 
> But why does it not return the correct number of records?  Like
> I say, I hardly ever use MemoPad and hot-sync daily.
> 
> Any other ideas?  BTW, the code below is exactly what I execute after
> opening the DB.  There are no other routines associated with this DB.  I
> open it then execute GetImportNames, as written.
> 
> Mike
> 
> 
> > ----- Original Message -----
> > From: S�rgio Carvalho <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, August 23, 1999 4:09 PM
> > Subject: Re: Reading/Writing MemoPad DBs ???
> >
> >
> > > Hi,
> > >
> > > Problem 1: Make sure you're not getting confused by deleted records.
> > > Deleted records stay in the DB until the next sincronization, so the
> > > total record count, and the 'live' record count may be different.
> > >
> > > Problem 2: If you try to write to the record, in the Do Something here
> > > section, you must use DmSet. Other than that, I guess your code is
> > > correct.
> > >
> > > Problem 3: Yes. A Memopad record is only a null terminated string.
> > > I've successfully read from it, with no problems. The pointer obtained
> > > by the record handle lock points to the first char. The best source of
> > > info about the MemPad database is the application source code
> > > (headers, mainly).
> > >
> > > Sergio
> > >
> > > Mike Davis wrote:
> > >
> > > > I am having a problem understanding how to read and write
> > > > a MemoPad record.
> > > >
> > > > I have looked at MemoPad application but is not really helping
> > > > me on this.  I have three problems (probably more).
> > > >
> > > > Problem 1:  I have placed a Custom Alert to tell me how many
> > > > records are in the DB.  The popup reports 535 records.  But
> > > > there are only 144 records.  I have verified the real number of
> > > > records by the count in MemoPad and by looking at the DB with
> > > > RsrcEdit app.  Both show 144 records.  Why the discrepancy?
> > > >
> > > > Problem 2:  I get a fatal error when I use this code.  I have
> > > > removed everything down to the bare minimum that causes the
> > > > crash.  The problem is with what is inside the 'for' block.  I
> > > > use this code to access another of my own DBs.  What is wrong
> > > > with this code?  Why does it crash?
> > > >
> > > > Problem 3:  I have looked at the MemoDB with RsrcEdit and it is just
> > > > a null terminated string for each record.  Doesn't RecPointer point
> > > > to the first char of the MemoPad data?  If not, what is the format
> > > > of the record pointed to by RecPointer?
> > > >
> > > > Where is the best source of documentation on a MemoPad record?
> > > > A simple app would help.
> > > >
> > > > Thanks
> > > >
> > > > void GetImportNames(void) {
> > > >     VoidHand    RecHandle;
> > > >     Ptr         RecPointer;
> > > >     int         i, numRecs;
> > > >     char        buffer[10];
> > > >
> > > >     numRecs = DmNumRecords(ImportDB);
> > > >         StrIToA(buffer, numRecs);
> > > >         FrmCustomAlert(altNotice, buffer, "", "");
> > > >
> > > >     for(i=0; i<numRecs; i++) {      // get names
> > > >         RecHandle = DmQueryRecord(ImportDB, i);
> > > >         RecPointer = MemHandleLock(RecHandle);
> > > >         // Do something here
> > > >                 // to access specific data
> > > >         MemPtrUnlock(RecPointer);
> > > >     }
> > > > }
> > > > --
> > > > -----------------------------------------------------------------
> > > > Discussion Group:        http://www.halcyon.com/ipscone/wwwboard/
> > > >
> > > > Protect your constitutional rights. Your favorite one may be next!
> > > > -----------------------------------------------------------------
> > >
> > > --
> > > Sergio Carvalho
> > > ---------------
> > > [EMAIL PROTECTED]
> > >
> > >
> > >
> >
> >
> 
> 
> --
> -----------------------------------------------------------------
> Discussion Group:        http://www.halcyon.com/ipscone/wwwboard/
> 
> Protect your constitutional rights. Your favorite one may be next!
> -----------------------------------------------------------------
> 
> 
> 


--
-----------------------------------------------------------------
Discussion Group:        http://www.halcyon.com/ipscone/wwwboard/

Protect your constitutional rights. Your favorite one may be next!
-----------------------------------------------------------------

Reply via email to