Hy again!

I was searching about theses questions, but, all the information that i
found is a bit complicated.

I have a database that have only 1 record, and 3 fields, like the schema
below:

RcaID    RcaName    RcaPassword
9            Daniel          teste


and 1 want to change the RcaPassword field.

then, i tried the folowing code, but is't not working.

Can anybody please, tell me where is the mistake and, show me the correct
way of doing this?
Ahh, if anybody knows where can a copy an example of writing databases on
palm, please give-me the link too.
Thanks!


         dbPtrF = NULL;
         OpenDatabase(&dbPtrF, "Config");  /*Open the database and set
dbPtrF as a Pointer to it*/

   {

       /*Struct used to store the RcaID, RcaName and RcaPassword*/
       typedef struct
       {
        Char *CodRca;
        Char *NomeRca;
        Char *Senha;
    } StructType;

    StructType *s;
    StructType theStructure;

    h = DmGetRecord(dbPtrF, 0);
    s= (StructType *)MemHandleLock(h);

    /*Here, the struct itens should have the content of the record? If yes,
this isn't happening. Why?*/
    theStructure = *s;

    /*Now, I'm changing the struct content...*/
    theStructure.CodRca="8";
    theStructure.NomeRca="Regis Daniel";
    theStructure.Senha="saf";

    /*And performin a DmWrite, that is executed without error...*/
    DmWrite(s, 0, &theStructure, sizeof(theStructure));
    MemHandleUnlock(h);
    DmReleaseRecord(dbPtrF,0,true);

   }

        /*But, when i query the record to see if the changes have been made,
it's not there...*/
         h = DmQueryRecord(dbPtrF, 0);
         Codigo = (Char *) MemHandleLock(h);
         Nome = Codigo + StrLen(Codigo) + 1;
         Senha = Nome + StrLen(Nome) + 1;
         MemHandleUnlock(h);
         DmCloseDatabase(dbPtrF);










"Régis Daniel de Oliveira" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
>
> Hy all!
>
> I need to perform the folowing operations in my program, but i get a
litlle
> bit confuse about the processes and functions that i need to use o perform
> the operations. Can anybody show me the best way, and the correct
functions
> to perform the operations?
>
>
>
> 1) Update a field on a specified record.
>
> 2) Permanent exclusion of a specified record.
>
> 3) Insertion of a record on a specified positiom.
>
> 4) Insertion of a record on a sorted specified position.
>
>
> Thanks all!
>
>
>
>
> Régis Daniel de Oliveira
>
>
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to