Hi
thanks so much. It works now. I can write to a database and retrieve the data
when I load the application again. The problem now is that I only retrieve the
first four characters. It does not matter if I write 5 or 10 characters, it
only retrieves four.
static void AppStop(void)
{
FormType* pForm;
MemHandle RecHandle;
MemPtr RecPointer;
FieldType* field_text;
Char *text;
FieldType* field_text;
Err error;
pForm = FrmGetActiveForm();
field_text = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, MainNameField));
text=FldGetTextPtr(text_field);
RecHandle=DmNewRecord(ntDB, &index, sizeof(&text)+1);
RecPointer = MemHandleLock(RecHandle);
DmWrite(RecPointer, 0, text, sizeof(&text)+1);
MemHandleUnlock(RecHandle);
DmReleaseRecord(ntDB, index, true);
DmCloseDatabase(ntDB);
FrmCloseAllForms();
}
And this is my code when I start the App
static Err AppStart(void)
{
MemHandle RecHandle;
MemPtr RecPointer;
Char *s;
Err error;
ntDB = DmOpenDatabaseByTypeCreator(DBType, CreatorID, dmModeReadWrite);
if (!ntDB)
{
error=DmCreateDatabase(0, DBName, CreatorID, DBType, false);
if(error==0)
ntDB = DmOpenDatabaseByTypeCreator(DBType, CreatorID, dmModeReadWrite);
RecHandle=DmQueryRecord(ntDB, index);
RecPointer = MemHandleLock(RecHandle);
MemHandleUnlock(RecHandle);
FrmGotoForm(MainForm);
return errNone;
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/