Hi
You can get the records from database in this fashion
/***********************************************************************
*
* FUNCTION: GetCushCareRecord
*
* DESCRIPTION: This routine gets data form the data base
* for the given record no in the category
* and places data into the structure.
*
* PARAMETERS: recordno,category
*
* RETURNED: 0 on success
*
***********************************************************************/
Err GetCushCareRecord(Word recno, Word category)
{
Handle recHandle;
CharPtr recText;
UInt indx = 0;
Err error;
error = GetRecordIndex(CareDB,category, recno, &indx);
if(error)
return error;
}
// Retrieve the record from the database and lock it down.
recHandle = DmQueryRecord(CareDB,indx);
recText = MemHandleLock(recHandle);
memcpy((char *) &care_rec,(char *) recText, sizeof(struct care_db_form));
// Unlock the handle to the record.
MemHandleUnlock(recHandle);
return 0;
}
Err GetRecordIndex (DmOpenRef db, Word category, Word recno, Word
*recIndexP)
{
Err error = 0;
*recIndexP = 0;
error = DmSeekRecordInCategory (db, recIndexP, 0,\
dmSeekForward, category);
if ( error )
{
DisplayAlert("error: get record index",ALERT_ERROR);
return error ;
}
error = DmSeekRecordInCategory (db, recIndexP, recno,\
dmSeekForward, category);
if ( error )
{
DisplayAlert("error: get record index",ALERT_ERROR);
return error;
}
return 0;
}
ThankU
Prasad B.N
[EMAIL PROTECTED]
----- Original Message -----
From: Thomas Martin <[EMAIL PROTECTED]>
To: Palm Developer Forum <[EMAIL PROTECTED]>
Sent: Friday, February 11, 2000 10:13 PM
Subject: database question
> I have created a record and saved the data of each field on my form in it
> successfully.
>
> I cannot however get my program to read the data back from those fields in
> the record.
>
> When I calculated the offsets to save the data I thought I could pretty
much
> do the same with the ponter to the record but I cannot seem to pull it
off.
>
> Is there any tips or simple / sample code showing the same. I looked at
the
> samples that came with CodeWarrior 6 but I am afraid I still cannot seem
to
> pull it off.
>
> Tommy Martin
>
>
>
> --
> 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