Sanjib.
Assuming that you already have your basic layout of a palm App (PilotMain,
EventLoop, and so), you need to define the structure of the records that you
will use, like
typedef struct namesdb
{
char name[40];
UInt32 dates[10]; // Every date on palm are stored like in seconds
since 01/Jan/1904
} namesDBrecord;
then you need to open your databese or create it if doesn't exist
DmOpenRef *dbP // this should be a global of your program
dbP = NULL;
dbP = DmOpenDatabase (0, DmFindDatabase(0, "names-db"), dmModeReadWrite);
if ( ! dbP )
{
createNamesDB ();
}
createNamesDB (void)
{
DmCreateDatabase(0, "names-db", 'CRID', 'DATA', 0);
dbP = DmOpenDatabase (0, DmFindDatabase(0, "names-db"), dmModeReadWrite);
}
Now to put data to a database record you can do something like
void
setNamesRecord (namesDBrecord rec, UInt16 index)
{
MemHandle memH;
MemPtr memP;
memH = DmNewRecord (dbP, &index, sizeof(namesDBrecord));
memP = MemHandleLock (memH);
DmWrite (memP, 0, &rec, sizeof(namesDBrecord));
MemHandleUnlock (memH);
DmReleaseRecord(dbP, index, true);
}
And to read it from the database
namesDBrecord
getNamesRecord (Int16 index)
{
MemHandle memH;
MemPtr memP;
namesDBrecord rec;
UInt8 i;
char datesS[10][10];
memH = (MemHandle) DmQueryRecord (dbP, index);
memP = MemHandleLock (memH);
StrNCopy (rec.name, ((namesDBrecord*)memP)->name, 40);
for (i=0;i<10;i++)
{
StrPrintF(datesS[i], "%lu", ((namesDBrecord*)memP)->dates[i]);
rec.dates[i] = StrAToI (datesS[i]);
}
MemHandleUnlock (memH);
return rec;
}
The rest is showing the data on the screen. And don't forget to close your
database when your app gets an appStopEvent.
if (dbP)
{
DmCloseDatabase (dbP);
}
Hope that this helps you.
Eduardo Orea
"sanjib mohanty" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
hello
this is sanjib
if i click on the name and again click on the view button it should be
biplay some ten dates can any boday send the logic for that i will be
very much thank full to them i am waiting for response.
Ragards
Sanjib
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/